diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-08-02 19:31:54 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-08-02 19:31:54 +0000 |
commit | f45e03e20173363f51056aa726a707ad8cf779df (patch) | |
tree | b66e7b0f1290aae2f58136edbed0f68d5b7491b7 /llvm/lib/Transforms/Scalar | |
parent | 8a482b33fed526b17a63e4539ca3036a89aea579 (diff) | |
download | bcm5719-llvm-f45e03e20173363f51056aa726a707ad8cf779df.tar.gz bcm5719-llvm-f45e03e20173363f51056aa726a707ad8cf779df.zip |
[IRCE] Preserve DomTree and LCSSA
This changes IRCE to "preserve" LCSSA and DomTree by recomputing them.
It still does not preserve LoopSimplify.
llvm-svn: 277505
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r-- | llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp index 52e94fa0766..dd3459f5676 100644 --- a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp +++ b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp @@ -570,6 +570,7 @@ class LoopConstrainer { Function &F; LLVMContext &Ctx; ScalarEvolution &SE; + DominatorTree &DT; // Information about the original loop we started out with. Loop &OriginalLoop; @@ -590,11 +591,12 @@ class LoopConstrainer { public: LoopConstrainer(Loop &L, LoopInfo &LI, const LoopStructure &LS, - ScalarEvolution &SE, InductiveRangeCheck::Range R) + ScalarEvolution &SE, DominatorTree &DT, + InductiveRangeCheck::Range R) : F(*L.getHeader()->getParent()), Ctx(L.getHeader()->getContext()), - SE(SE), OriginalLoop(L), OriginalLoopInfo(LI), LatchTakenCount(nullptr), - OriginalPreheader(nullptr), MainLoopPreheader(nullptr), Range(R), - MainLoopStructure(LS) {} + SE(SE), DT(DT), OriginalLoop(L), OriginalLoopInfo(LI), + LatchTakenCount(nullptr), OriginalPreheader(nullptr), + MainLoopPreheader(nullptr), Range(R), MainLoopStructure(LS) {} // Entry point for the algorithm. Returns true on success. bool run(); @@ -1274,6 +1276,9 @@ bool LoopConstrainer::run() { addToParentLoopIfNeeded(PreLoop.Blocks); addToParentLoopIfNeeded(PostLoop.Blocks); + DT.recalculate(F); + formLCSSARecursively(OriginalLoop, DT, &OriginalLoopInfo, &SE); + return true; } @@ -1444,8 +1449,9 @@ bool InductiveRangeCheckElimination::runOnLoop(Loop *L, LPPassManager &LPM) { if (!SafeIterRange.hasValue()) return false; + auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree(); LoopConstrainer LC(*L, getAnalysis<LoopInfoWrapperPass>().getLoopInfo(), LS, - SE, SafeIterRange.getValue()); + SE, DT, SafeIterRange.getValue()); bool Changed = LC.run(); if (Changed) { |