mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
Require chained analyses in BasicAA and AAResults to be transitive
This patch fixes a bug that could result in miscompiles (at least in an OOT target). The problem could be seen by adding checks that the DominatorTree used in BasicAliasAnalysis and ValueTracking was valid (e.g. by adding DT->verify() call before every DT dereference and then running all tests in test/CodeGen). Problem was that the LegacyPassManager calculated "last user" incorrectly for passes such as the DominatorTree when not telling the pass manager that there was a transitive dependency between the different analyses. And then it could happen that an incorrect dominator tree was used when doing alias analysis (which was a pretty serious bug as the alias analysis result could be invalid). Fixes: https://bugs.llvm.org/show_bug.cgi?id=48709 Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D94138
This commit is contained in:
parent
8fb012df95
commit
0798093f86
@ -883,8 +883,8 @@ bool AAResultsWrapperPass::runOnFunction(Function &F) {
|
||||
|
||||
void AAResultsWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
AU.addRequired<BasicAAWrapperPass>();
|
||||
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||
AU.addRequiredTransitive<BasicAAWrapperPass>();
|
||||
AU.addRequiredTransitive<TargetLibraryInfoWrapperPass>();
|
||||
|
||||
// We also need to mark all the alias analysis passes we will potentially
|
||||
// probe in runOnFunction as used here to ensure the legacy pass manager
|
||||
|
@ -1899,9 +1899,9 @@ bool BasicAAWrapperPass::runOnFunction(Function &F) {
|
||||
|
||||
void BasicAAWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
AU.addRequired<AssumptionCacheTracker>();
|
||||
AU.addRequired<DominatorTreeWrapperPass>();
|
||||
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||
AU.addRequiredTransitive<AssumptionCacheTracker>();
|
||||
AU.addRequiredTransitive<DominatorTreeWrapperPass>();
|
||||
AU.addRequiredTransitive<TargetLibraryInfoWrapperPass>();
|
||||
AU.addUsedIfAvailable<PhiValuesWrapperPass>();
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,6 @@ public:
|
||||
AU.addRequiredID(LoopSimplifyID);
|
||||
AU.addRequiredID(LCSSAID);
|
||||
AU.addRequired<AAResultsWrapperPass>();
|
||||
AU.addPreserved<AAResultsWrapperPass>();
|
||||
AU.addRequired<ScalarEvolutionWrapperPass>();
|
||||
AU.addRequired<DominatorTreeWrapperPass>();
|
||||
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||
|
@ -547,7 +547,6 @@ public:
|
||||
AU.addPreserved<DominatorTreeWrapperPass>();
|
||||
AU.addPreserved<MemorySSAWrapperPass>();
|
||||
AU.addPreserved<GlobalsAAWrapperPass>();
|
||||
AU.addPreserved<AAResultsWrapperPass>();
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user