#
de40e743 |
| 28-Feb-2016 |
NAKAMURA Takumi <geek4civic@gmail.com> |
[PM] Appease mingw32's auto-import DLL build with minimal tweaks.
char AnalysisBase::ID should be declared as extern and defined in one module.
llvm-svn: 262185
|
#
afcec4c5 |
| 27-Feb-2016 |
Chandler Carruth <chandlerc@gmail.com> |
[PM] Provide explicit instantiation declarations and definitions for the PassManager and AnalysisManager template specializations as well.
llvm-svn: 262128
|
#
2a54094d |
| 27-Feb-2016 |
Chandler Carruth <chandlerc@gmail.com> |
[PM] Provide two templates for the two directionalities of analysis manager proxies and use those rather than repeating their definition four times.
There are real differences between the two direct
[PM] Provide two templates for the two directionalities of analysis manager proxies and use those rather than repeating their definition four times.
There are real differences between the two directions: outer AMs are const and don't need to have invalidation tracked. But every proxy in a particular direction is identical except for the analysis manager type and the IR unit they proxy into. This makes them prime candidates for nice templates.
I've started introducing explicit template instantiation declarations and definitions as well because we really shouldn't be emitting all this everywhere. I'm going to go back and add the same for the other templates like this in a follow-up patch.
I've left the analysis manager as an opaque type rather than using two IR units and requiring it to be an AnalysisManager template specialization. I think its important that users retain the ability to provide their own custom analysis management layer and provided it has the appropriate API everything should Just Work.
llvm-svn: 262127
show more ...
|
#
3a634355 |
| 26-Feb-2016 |
Chandler Carruth <chandlerc@gmail.com> |
[PM] Introduce CRTP mixin base classes to help define passes and analyses in the new pass manager.
These just handle really basic stuff: turning a type name into a string statically that is nice to
[PM] Introduce CRTP mixin base classes to help define passes and analyses in the new pass manager.
These just handle really basic stuff: turning a type name into a string statically that is nice to print in logs, and getting a static unique ID for each analysis.
Sadly, the format of passes in anonymous namespaces makes using their names in tests really annoying so I've customized the names of the no-op passes to keep tests sane to read.
This is the first of a few simplifying refactorings for the new pass manager that should reduce boilerplate and confusion.
llvm-svn: 262004
show more ...
|
Revision tags: llvmorg-3.8.0-rc3 |
|
#
c5d211ef |
| 23-Feb-2016 |
Chandler Carruth <chandlerc@gmail.com> |
[PM] Remove an overly aggressive assert now that I can actually test the pattern that triggers it. This essentially requires an immutable function analysis, as that will survive anything we do to inv
[PM] Remove an overly aggressive assert now that I can actually test the pattern that triggers it. This essentially requires an immutable function analysis, as that will survive anything we do to invalidate it. When we have such patterns, the function analysis manager will not get cleared between runs of the proxy.
If we actually need an assert about how things are queried, we can add more elaborate machinery for computing it, but so far I'm not aware of significant value provided.
Thanks to Justin Lebar for noticing this when he made a (seemingly innocuous) change to FunctionAttrs that is enough to trigger it in one test there. Now it is covered by a direct test of the pass manager code.
llvm-svn: 261627
show more ...
|
#
77b6e47f |
| 23-Feb-2016 |
Chandler Carruth <chandlerc@gmail.com> |
[PM] Improve the API and comments around the analysis manager proxies.
These are really handles that ensure the analyses get cleared at appropriate places, and as such copying doesn't really make se
[PM] Improve the API and comments around the analysis manager proxies.
These are really handles that ensure the analyses get cleared at appropriate places, and as such copying doesn't really make sense. Instead, they should look more like unique ownership objects. Make that the case.
Relatedly, if you create a temporary of one and move out of it its destructor shouldn't actually clear anything. I don't think there is any code that can trigger this currently, but it seems like a more robust implementation.
If folks want, I can add a unittest that forces this to be exercised, but that seems somewhat pointless -- whether a temporary is ever created in the innards of AnalysisManager is not really something we should be adding a reliance on, but I didn't want to leave a timebomb in the code here.
If anyone has a cleaner way to represent this, I'm all ears, but I wanted to assure myself that this wasn't in fact responsible for another bug I'm chasing down (it wasn't) and figured I'd commit that.
llvm-svn: 261594
show more ...
|
Revision tags: llvmorg-3.8.0-rc2, llvmorg-3.8.0-rc1, llvmorg-3.7.1, llvmorg-3.7.1-rc2, llvmorg-3.7.1-rc1, llvmorg-3.7.0, llvmorg-3.7.0-rc4, llvmorg-3.7.0-rc3, studio-1.4, llvmorg-3.7.0-rc2, llvmorg-3.7.0-rc1, llvmorg-3.6.2, llvmorg-3.6.2-rc1, llvmorg-3.6.1, llvmorg-3.6.1-rc1, llvmorg-3.5.2, llvmorg-3.5.2-rc1, llvmorg-3.6.0, llvmorg-3.6.0-rc4, llvmorg-3.6.0-rc3, llvmorg-3.6.0-rc2, llvmorg-3.6.0-rc1 |
|
#
703378f1 |
| 13-Jan-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM] Remove the defunt CGSCC-specific debug flag.
Even before I sunk the debug flag into the opt tool this had been made obsolete by factoring the pass and analysis managers into a single set of tem
[PM] Remove the defunt CGSCC-specific debug flag.
Even before I sunk the debug flag into the opt tool this had been made obsolete by factoring the pass and analysis managers into a single set of templates that all used the core flag. No functionality changed here.
llvm-svn: 225842
show more ...
|
#
816702ff |
| 13-Jan-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM] Refactor the new pass manager to use a single template to implement the generic functionality of the pass managers themselves.
In the new infrastructure, the pass "manager" isn't actually inter
[PM] Refactor the new pass manager to use a single template to implement the generic functionality of the pass managers themselves.
In the new infrastructure, the pass "manager" isn't actually interesting at all. It just pipelines a single chunk of IR through N passes. We don't need to know anything about the IR or the passes to do this really and we can replace the 3 implementations of the exact same functionality with a single generic PassManager template, complementing the single generic AnalysisManager template.
I've left typedefs in place to give convenient names to the various obvious instantiations of the template.
With this, I think I've nuked almost all of the redundant logic in the managers, and I think the overall design is actually simpler for having single templates that clearly indicate there is no special logic here. The logging is made somewhat more annoying by this change, but I don't think the difference is worth having heavy-weight traits to help log things.
llvm-svn: 225783
show more ...
|
#
7ad6d620 |
| 13-Jan-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM] Fold all three analysis managers into a single AnalysisManager template.
This consolidates three copies of nearly the same core logic. It adds "complexity" to the ModuleAnalysisManager in that
[PM] Fold all three analysis managers into a single AnalysisManager template.
This consolidates three copies of nearly the same core logic. It adds "complexity" to the ModuleAnalysisManager in that it makes it possible to share a ModuleAnalysisManager across multiple modules... But it does so by deleting *all of the code*, so I'm OK with that. This will naturally make fixing bugs in this code much simpler, etc.
The only down side here is that we have to use 'typename' and 'this->' in various places, and the implementation is lifted into the header. I'll take that for the code size reduction.
The convenient names are still typedef-ed and used throughout so that users can largely ignore this aspect of the implementation.
The follow-up change to this will do the exact same refactoring for the PassManagers. =D
It turns out that the interesting different code is almost entirely in the adaptors. At the end, that should be essentially all that is left.
llvm-svn: 225757
show more ...
|
#
2e7522e9 |
| 13-Jan-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM] Re-clang-format much of this code as the code has changed some and so has clang-format. Notably, this fixes a bunch of formatting in the CGSCC pass manager side of things that has been improved
[PM] Re-clang-format much of this code as the code has changed some and so has clang-format. Notably, this fixes a bunch of formatting in the CGSCC pass manager side of things that has been improved in clang-format recently.
llvm-svn: 225743
show more ...
|
#
fdb41805 |
| 07-Jan-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM] Fix a pretty nasty bug where the new pass manager would invalidate passes too many time.
I think this is actually the issue that someone raised with me at the developer's meeting and in an emai
[PM] Fix a pretty nasty bug where the new pass manager would invalidate passes too many time.
I think this is actually the issue that someone raised with me at the developer's meeting and in an email, but that we never really got to the bottom of. Having all the testing utilities made it much easier to dig down and uncover the core issue.
When a pass manager is running many passes over a single function, we need it to invalidate the analyses between each run so that they can be re-computed as needed. We also need to track the intersection of preserved higher-level analyses across all the passes that we run (for example, if there is one module analysis which all the function analyses preserve, we want to track that and propagate it). Unfortunately, this interacted poorly with any enclosing pass adaptor between two IR units. It would see the intersection of preserved analyses, and need to invalidate any other analyses, but some of the un-preserved analyses might have already been invalidated *and recomputed*! We would fail to propagate the fact that the analysis had already been invalidated.
The solution to this struck me as really strange at first, but the more I thought about it, the more natural it seemed. After a nice discussion with Duncan about it on IRC, it seemed even nicer. The idea is that invalidating an analysis *causes* it to be preserved! Preserving the lack of result is trivial. If it is recomputed, great. Until something *else* invalidates it again, we're good.
The consequence of this is that the invalidate methods on the analysis manager which operate over many passes now consume their PreservedAnalyses object, update it to "preserve" every analysis pass to which it delivers an invalidation (regardless of whether the pass chooses to be removed, or handles the invalidation itself by updating itself). Then we return this augmented set from the invalidate routine, letting the pass manager take the result and use the intersection of *that* across each pass run to compute the final preserved set. This accounts for all the places where the early invalidation of an analysis has already "preserved" it for a future run.
I've beefed up the testing and adjusted the assertions to show that we no longer repeatedly invalidate or compute the analyses across nested pass managers.
llvm-svn: 225333
show more ...
|
#
3472ffb3 |
| 06-Jan-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM] Add a utility pass template that synthesizes the invalidation of a specific analysis result.
This is quite handy to test things, and will also likely be very useful for debugging issues. You co
[PM] Add a utility pass template that synthesizes the invalidation of a specific analysis result.
This is quite handy to test things, and will also likely be very useful for debugging issues. You could narrow down pass validation failures by walking these invalidate pass runs up and down the pass pipeline, etc. I've added support to the pass pipeline parsing to be able to create one of these for any analysis pass desired.
Just adding this class uncovered one latent bug where the AnalysisManager CRTP base class had a hard-coded Module type rather than using IRUnitT.
I've also added tests for invalidation and caching of analyses in a basic way across all the pass managers. These in turn uncovered two more bugs where we failed to correctly invalidate an analysis -- its results were invalidated but the key for re-running the pass was never cleared and so it was never re-run. Quite nasty. I'm very glad to debug this here rather than with a full system.
Also, yes, the naming here is horrid. I'm going to update some of the names to be slightly less awful shortly. But really, I've no "good" ideas for naming. I'll be satisfied if I can get it to "not bad".
llvm-svn: 225246
show more ...
|
#
0b576b37 |
| 06-Jan-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM] Add a collection of no-op analysis passes and switch the new pass manager tests to use them and be significantly more comprehensive.
This, naturally, uncovered a bug where the CGSCC pass manage
[PM] Add a collection of no-op analysis passes and switch the new pass manager tests to use them and be significantly more comprehensive.
This, naturally, uncovered a bug where the CGSCC pass manager wasn't printing analyses when they were run.
The only remaining core manipulator is I think an invalidate pass similar to the require pass. That'll be next. =]
llvm-svn: 225240
show more ...
|
#
539dc4b9 |
| 05-Jan-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM] Don't run the machinery of invalidating all the analysis passes when all are being preserved.
We want to short-circuit this for a couple of reasons. One, I don't really want passes to grow a de
[PM] Don't run the machinery of invalidating all the analysis passes when all are being preserved.
We want to short-circuit this for a couple of reasons. One, I don't really want passes to grow a dependency on actually receiving their invalidate call when they've been preserved. I'm thinking about removing this entirely. But more importantly, preserving everything is likely to be the common case in a lot of scenarios, and it would be really good to bypass all of the invalidation and preservation machinery there. Avoiding calling N opaque functions to try to invalidate things that are by definition still valid seems important. =]
This wasn't really inpsired by much other than seeing the spam in the logging for analyses, but it seems better ot get it checked in rather than forgetting about it.
llvm-svn: 225163
show more ...
|
#
e5e8fb3b |
| 05-Jan-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM] Add names and debug logging for analysis passes to the new pass manager.
This starts to allow us to test analyses more easily, but it's really only the beginning. Some of the code here is still
[PM] Add names and debug logging for analysis passes to the new pass manager.
This starts to allow us to test analyses more easily, but it's really only the beginning. Some of the code here is still untestable without manual changes to create analysis passes, but I wanted to factor it into a small of chunks as possible.
Next up in order to be able to test things are, in no particular order: - No-op analyses passes so we don't have to use real ones to exercise the pass maneger itself. - Automatic way of generating dummy passes that require an analysis be run, including a variant that calls a 'print' method on a pass to make it even easier to print out the results of an analysis. - Dummy passes that invalidate all analyses for their IR unit so we can test invalidation and re-runs. - Automatic way to print each analysis pass as it is re-run. - Automatic but optional verification of analysis passes everywhere possible.
I'm not claiming I'll get to all of these immediately, but that's what is in the pipeline at some stage. I'm fleshing out exactly what I need and what to prioritize by working on converting analyses and then trying to test the conversion. =]
llvm-svn: 225162
show more ...
|
#
d174ce4a |
| 05-Jan-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM] Switch the new pass manager to use a reference-based API for IR units.
This was debated back and forth a bunch, but using references is now clearly cleaner. Of all the code written using pointe
[PM] Switch the new pass manager to use a reference-based API for IR units.
This was debated back and forth a bunch, but using references is now clearly cleaner. Of all the code written using pointers thus far, in only one place did it really make more sense to have a pointer. In most cases, this just removes immediate dereferencing from the code. I think it is much better to get errors on null IR units earlier, potentially at compile time, than to delay it.
Most notably, the legacy pass manager uses references for its routines and so as more and more code works with both, the use of pointers was likely to become really annoying. I noticed this when I ported the domtree analysis over and wrote the entire thing with references only to have it fail to compile. =/ It seemed better to switch now than to delay. We can, of course, revisit this is we learn that references are really problematic in the API.
llvm-svn: 225145
show more ...
|
Revision tags: llvmorg-3.5.1, llvmorg-3.5.1-rc2, llvmorg-3.5.1-rc1, llvmorg-3.5.0, llvmorg-3.5.0-rc4, llvmorg-3.5.0-rc3, llvmorg-3.5.0-rc2, llvmorg-3.5.0-rc1, llvmorg-3.4.2, llvmorg-3.4.2-rc1, llvmorg-3.4.1, llvmorg-3.4.1-rc2 |
|
#
572e3407 |
| 21-Apr-2014 |
Chandler Carruth <chandlerc@gmail.com> |
[PM] Add a new-PM-style CGSCC pass manager using the newly added LazyCallGraph analysis framework. Wire it up all the way through the opt driver and add some very basic testing that we can build pass
[PM] Add a new-PM-style CGSCC pass manager using the newly added LazyCallGraph analysis framework. Wire it up all the way through the opt driver and add some very basic testing that we can build pass pipelines including these components. Still a lot more to do in terms of testing that all of this works, but the basic pieces are here.
There is a *lot* of boiler plate here. It's something I'm going to actively look at reducing, but I don't have any immediate ideas that don't end up making the code terribly complex in order to fold away the boilerplate. Until I figure out something to minimize the boilerplate, almost all of this is based on the code for the existing pass managers, copied and heavily adjusted to suit the needs of the CGSCC pass management layer.
The actual CG management still has a bunch of FIXMEs in it. Notably, we don't do *any* updating of the CG as it is potentially invalidated. I wanted to get this in place to motivate the new analysis, and add update APIs to the analysis and the pass management layers in concert to make sure that the *right* APIs are present.
llvm-svn: 206745
show more ...
|