llvm-6502/include/llvm
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
..
ADT Triple: Add amdgcn triple 2015-01-06 18:00:00 +00:00
Analysis [PM] Fix a pretty nasty bug where the new pass manager would invalidate 2015-01-07 01:58:35 +00:00
AsmParser Pass a MemoryBufferRef when we can avoid taking ownership. 2014-08-26 21:49:01 +00:00
Bitcode [PM] Switch the new pass manager to use a reference-based API for IR 2015-01-05 02:47:05 +00:00
CodeGen Revert r224935 "Refactor duplicated code. No intended functionality change." 2015-01-06 23:04:36 +00:00
Config [multilib] Add support to the autoconf build to substitute 2014-12-29 11:58:17 +00:00
DebugInfo [DebugInfo] Move all DWARF headers to the public include directory. 2014-12-19 18:26:33 +00:00
ExecutionEngine [MCJIT] Unique-ptrify the RTDyldMemoryManager member of MCJIT. NFC. 2014-12-03 00:51:19 +00:00
IR [PM] Fix a pretty nasty bug where the new pass manager would invalidate 2015-01-07 01:58:35 +00:00
IRReader Pass a MemoryBufferRef when we can avoid taking ownership. 2014-08-26 21:49:01 +00:00
LineEditor [C++11] Replace OwningPtr with std::unique_ptr in places where it doesn't break the API. 2014-04-21 09:34:48 +00:00
Linker Turn some DenseMaps that are only used for set operations into DenseSets. 2014-12-06 19:22:54 +00:00
LTO Remove StringMap::GetOrCreateValue in favor of StringMap::insert 2014-11-19 05:49:42 +00:00
MC Revert r224935 "Refactor duplicated code. No intended functionality change." 2015-01-06 23:04:36 +00:00
Object Add printing the LC_THREAD load commands with llvm-objdump’s -private-headers. 2014-12-23 22:56:39 +00:00
Option Add an overload of getLastArgNoClaim taking two OptSpecifiers. 2014-09-12 19:42:53 +00:00
ProfileData llvm-cov: Sink some reporting logic into CoverageMapping 2014-11-14 01:50:32 +00:00
Support Another attempt to fix the LLVM Windows build bot lld-x86_64-win7, one last place to fix I think. 2014-12-24 00:16:51 +00:00
TableGen Make MultiClass::DefPrototypes own their Records to fix memory leaks. 2014-12-11 05:25:33 +00:00
Target Revert r224935 "Refactor duplicated code. No intended functionality change." 2015-01-06 23:04:36 +00:00
Transforms [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
CMakeLists.txt Remove llvm_headers_do_not_build for the benefit of XCode and Visual Studio users. 2014-08-14 00:51:47 +00:00
InitializePasses.h [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
LinkAllIR.h [cleanup] Move the Dominators.h and Verifier.h headers into the IR 2014-01-13 09:26:24 +00:00
LinkAllPasses.h InstrProf: An intrinsic and lowering for instrumentation based profiling 2014-12-08 18:02:35 +00:00
module.modulemap Update the modules build to match r223802. 2014-12-12 02:25:18 +00:00
module.modulemap.build [modules] Add module maps for LLVM. These are not quite ready for prime-time 2014-05-21 02:46:14 +00:00
Pass.h Revert "[PM] Add pass run listeners to the pass manager." 2014-05-15 17:49:20 +00:00
PassAnalysisSupport.h [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-14 00:51:57 +00:00
PassInfo.h Remove pimpl class from PassRegistry. 2014-06-12 16:06:51 +00:00
PassManager.h Move the old pass manager infrastructure into a legacy namespace and 2013-11-09 12:26:54 +00:00
PassRegistry.h [PM] Remove an unused and rather expensive mapping from an analysis 2014-10-06 00:30:59 +00:00
PassSupport.h Defining a new API for debug options that doesn't rely on static global cl::opts. 2014-10-15 21:54:35 +00:00