diff options
author | Dan Gohman <gohman@apple.com> | 2010-07-26 18:11:16 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-07-26 18:11:16 +0000 |
commit | 052f0001588a1613f845c84c04b38ced28ad6711 (patch) | |
tree | 58f6b3bd052fe6e2e779eebe5d4e11f4c9619d17 /lib | |
parent | 572365ec88aeb78908acb7efe381e45ab0b4a50a (diff) | |
download | external_llvm-052f0001588a1613f845c84c04b38ced28ad6711.zip external_llvm-052f0001588a1613f845c84c04b38ced28ad6711.tar.gz external_llvm-052f0001588a1613f845c84c04b38ced28ad6711.tar.bz2 |
Remove LCSSA's bogus dependence on LoopSimplify and LoopSimplify's bogus
dependence on DominanceFrontier. Instead, add an explicit DominanceFrontier
pass in StandardPasses.h to ensure that it gets scheduled at the right
time.
Declare that loop unrolling preserves ScalarEvolution, and shuffle some
getAnalysisUsages.
This eliminates one LoopSimplify and one LCCSA run in the standard
compile opts sequence.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109413 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/LoopDeletion.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Scalar/LoopUnrollPass.cpp | 7 | ||||
-rw-r--r-- | lib/Transforms/Utils/LCSSA.cpp | 9 | ||||
-rw-r--r-- | lib/Transforms/Utils/LoopSimplify.cpp | 13 |
4 files changed, 12 insertions, 19 deletions
diff --git a/lib/Transforms/Scalar/LoopDeletion.cpp b/lib/Transforms/Scalar/LoopDeletion.cpp index 354b033..bd0e207 100644 --- a/lib/Transforms/Scalar/LoopDeletion.cpp +++ b/lib/Transforms/Scalar/LoopDeletion.cpp @@ -38,9 +38,9 @@ namespace { bool &Changed, BasicBlock *Preheader); virtual void getAnalysisUsage(AnalysisUsage& AU) const { - AU.addRequired<ScalarEvolution>(); AU.addRequired<DominatorTree>(); AU.addRequired<LoopInfo>(); + AU.addRequired<ScalarEvolution>(); AU.addRequiredID(LoopSimplifyID); AU.addRequiredID(LCSSAID); diff --git a/lib/Transforms/Scalar/LoopUnrollPass.cpp b/lib/Transforms/Scalar/LoopUnrollPass.cpp index 1b4583d..3d446f0 100644 --- a/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -17,6 +17,7 @@ #include "llvm/Transforms/Scalar.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/InlineCost.h" +#include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" @@ -55,17 +56,19 @@ namespace { /// loop preheaders be inserted into the CFG... /// virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired<LoopInfo>(); + AU.addPreserved<LoopInfo>(); AU.addRequiredID(LoopSimplifyID); + AU.addPreservedID(LoopSimplifyID); AU.addRequiredID(LCSSAID); - AU.addRequired<LoopInfo>(); AU.addPreservedID(LCSSAID); - AU.addPreserved<LoopInfo>(); // FIXME: Loop unroll requires LCSSA. And LCSSA requires dom info. // If loop unroll does not preserve dom info then LCSSA pass on next // loop will receive invalid dom info. // For now, recreate dom info, if loop is unrolled. AU.addPreserved<DominatorTree>(); AU.addPreserved<DominanceFrontier>(); + AU.addPreserved<ScalarEvolution>(); } }; } diff --git a/lib/Transforms/Utils/LCSSA.cpp b/lib/Transforms/Utils/LCSSA.cpp index 5967cb9..d380e0d 100644 --- a/lib/Transforms/Utils/LCSSA.cpp +++ b/lib/Transforms/Utils/LCSSA.cpp @@ -64,17 +64,12 @@ namespace { virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesCFG(); - AU.addRequiredTransitive<DominatorTree>(); + AU.addRequired<DominatorTree>(); AU.addPreserved<DominatorTree>(); AU.addPreserved<DominanceFrontier>(); - AU.addRequiredTransitive<LoopInfo>(); + AU.addRequired<LoopInfo>(); AU.addPreserved<LoopInfo>(); - - // LCSSA doesn't actually require LoopSimplify, but the PassManager - // doesn't know how to schedule LoopSimplify by itself. - AU.addRequiredID(LoopSimplifyID); AU.addPreservedID(LoopSimplifyID); - AU.addPreserved<ScalarEvolution>(); } private: diff --git a/lib/Transforms/Utils/LoopSimplify.cpp b/lib/Transforms/Utils/LoopSimplify.cpp index 6b1eaad..1571fe8 100644 --- a/lib/Transforms/Utils/LoopSimplify.cpp +++ b/lib/Transforms/Utils/LoopSimplify.cpp @@ -77,22 +77,17 @@ namespace { virtual void getAnalysisUsage(AnalysisUsage &AU) const { // We need loop information to identify the loops... - AU.addRequiredTransitive<DominatorTree>(); + AU.addRequired<DominatorTree>(); AU.addPreserved<DominatorTree>(); - // Request DominanceFrontier now, even though LoopSimplify does - // not use it. This allows Pass Manager to schedule Dominance - // Frontier early enough such that one LPPassManager can handle - // multiple loop transformation passes. - AU.addRequired<DominanceFrontier>(); - AU.addPreserved<DominanceFrontier>(); - - AU.addRequiredTransitive<LoopInfo>(); + AU.addRequired<LoopInfo>(); AU.addPreserved<LoopInfo>(); AU.addPreserved<AliasAnalysis>(); AU.addPreserved<ScalarEvolution>(); AU.addPreservedID(BreakCriticalEdgesID); // No critical edges added. + AU.addPreserved<DominanceFrontier>(); + AU.addPreservedID(LCSSAID); } /// verifyAnalysis() - Verify LoopSimplifyForm's guarantees. |