llvm-6502/lib/IR
Chandler Carruth 9fc5a53118 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225333 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-07 01:58:35 +00:00
..
AsmWriter.cpp Change the .ll syntax for comdats and add a syntactic sugar. 2015-01-06 22:55:16 +00:00
AsmWriter.h
AttributeImpl.h
Attributes.cpp
AutoUpgrade.cpp IR: Split Metadata from Value 2014-12-09 18:38:53 +00:00
BasicBlock.cpp The leak detector is dead, long live asan and valgrind. 2014-12-22 13:00:36 +00:00
CMakeLists.txt The leak detector is dead, long live asan and valgrind. 2014-12-22 13:00:36 +00:00
Comdat.cpp
ConstantFold.cpp ConstantFold: Shifting undef by zero results in undef 2014-12-18 23:54:43 +00:00
ConstantFold.h
ConstantRange.cpp
Constants.cpp
ConstantsContext.h
Core.cpp IR: Split Metadata from Value 2014-12-09 18:38:53 +00:00
DataLayout.cpp DataLayout: Provide nicer diagnostics for malformed strings 2014-12-10 02:36:41 +00:00
DebugInfo.cpp Remove isSubroutineType test for isCompositeType, getTag() is enough. 2014-12-19 22:15:09 +00:00
DebugLoc.cpp IR: Split Metadata from Value 2014-12-09 18:38:53 +00:00
DiagnosticInfo.cpp IR: Split Metadata from Value 2014-12-09 18:38:53 +00:00
DiagnosticPrinter.cpp
DIBuilder.cpp DIBuilder: Similar to createPointerType, make createMemberPointerType take 2014-12-23 19:11:47 +00:00
Dominators.cpp
Function.cpp Masked Load/Store - Changed the order of parameters in intrinsics. 2014-12-25 07:49:20 +00:00
GCOV.cpp
Globals.cpp The leak detector is dead, long live asan and valgrind. 2014-12-22 13:00:36 +00:00
GVMaterializer.cpp
InlineAsm.cpp
Instruction.cpp The leak detector is dead, long live asan and valgrind. 2014-12-22 13:00:36 +00:00
Instructions.cpp IR: Split Metadata from Value 2014-12-09 18:38:53 +00:00
IntrinsicInst.cpp IR: Split Metadata from Value 2014-12-09 18:38:53 +00:00
IRBuilder.cpp Some code improvements in Masked Load/Store. 2014-12-30 14:28:14 +00:00
IRPrintingPasses.cpp [PM] Switch the new pass manager to use a reference-based API for IR 2015-01-05 02:47:05 +00:00
LeaksContext.h IR: Store MDNodes in a separate LeakDetector container 2014-12-11 21:39:39 +00:00
LegacyPassManager.cpp Document that PassManager::add() may delete the pass right away. 2014-12-12 01:27:01 +00:00
LLVMBuild.txt
LLVMContext.cpp Fix LLVMContext to match what MDKind names that the LL parser permits. Fixes PR21799! 2014-12-11 02:10:28 +00:00
LLVMContextImpl.cpp IR: Split Metadata from Value 2014-12-09 18:38:53 +00:00
LLVMContextImpl.h IR: Split Metadata from Value 2014-12-09 18:38:53 +00:00
Makefile
Mangler.cpp
MDBuilder.cpp IR: Split Metadata from Value 2014-12-09 18:38:53 +00:00
Metadata.cpp IR: Don't drop MDNode uniquing on null operands 2015-01-05 23:31:54 +00:00
MetadataTracking.cpp IR: Split Metadata from Value 2014-12-09 18:38:53 +00:00
Module.cpp The leak detector is dead, long live asan and valgrind. 2014-12-22 13:00:36 +00:00
module.modulemap
Pass.cpp
PassManager.cpp [PM] Fix a pretty nasty bug where the new pass manager would invalidate 2015-01-07 01:58:35 +00:00
PassRegistry.cpp
Statepoint.cpp
SymbolTableListTraitsImpl.h
Type.cpp
TypeFinder.cpp IR: Split Metadata from Value 2014-12-09 18:38:53 +00:00
Use.cpp
UseListOrder.cpp
User.cpp
Value.cpp The leak detector is dead, long live asan and valgrind. 2014-12-22 13:00:36 +00:00
ValueSymbolTable.cpp IR: Split Metadata from Value 2014-12-09 18:38:53 +00:00
ValueTypes.cpp
Verifier.cpp [PM] Switch the new pass manager to use a reference-based API for IR 2015-01-05 02:47:05 +00:00