diff options
| author | Max Kazantsev <max.kazantsev@azul.com> | 2018-12-29 04:26:22 +0000 |
|---|---|---|
| committer | Max Kazantsev <max.kazantsev@azul.com> | 2018-12-29 04:26:22 +0000 |
| commit | 201534d753ff92f2f2e65de65c1416087fb21505 (patch) | |
| tree | 543a5f8d360c5bc4ec64a92610bf6592dcb29a1b /llvm/lib | |
| parent | 4d98dfb67d3df4424f4ffc0dfff3105b946b6443 (diff) | |
| download | bcm5719-llvm-201534d753ff92f2f2e65de65c1416087fb21505.tar.gz bcm5719-llvm-201534d753ff92f2f2e65de65c1416087fb21505.zip | |
Drop SE cache early because loop parent can change in LoopSimplifyCFG
llvm-svn: 350145
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp b/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp index 4517b9b8f06..c8461655770 100644 --- a/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp +++ b/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp @@ -87,6 +87,7 @@ private: Loop &L; LoopInfo &LI; DominatorTree &DT; + ScalarEvolution &SE; MemorySSAUpdater *MSSAU; // Whether or not the current loop has irreducible CFG. @@ -459,8 +460,9 @@ private: public: ConstantTerminatorFoldingImpl(Loop &L, LoopInfo &LI, DominatorTree &DT, + ScalarEvolution &SE, MemorySSAUpdater *MSSAU) - : L(L), LI(LI), DT(DT), MSSAU(MSSAU) {} + : L(L), LI(LI), DT(DT), SE(SE), MSSAU(MSSAU) {} bool run() { assert(L.getLoopLatch() && "Should be single latch!"); @@ -507,6 +509,7 @@ public: return false; } + SE.forgetTopmostLoop(&L); // Dump analysis results. LLVM_DEBUG(dump()); @@ -539,6 +542,7 @@ public: /// Turn branches and switches with known constant conditions into unconditional /// branches. static bool constantFoldTerminators(Loop &L, DominatorTree &DT, LoopInfo &LI, + ScalarEvolution &SE, MemorySSAUpdater *MSSAU) { if (!EnableTermFolding) return false; @@ -548,7 +552,7 @@ static bool constantFoldTerminators(Loop &L, DominatorTree &DT, LoopInfo &LI, if (!L.getLoopLatch()) return false; - ConstantTerminatorFoldingImpl BranchFolder(L, LI, DT, MSSAU); + ConstantTerminatorFoldingImpl BranchFolder(L, LI, DT, SE, MSSAU); return BranchFolder.run(); } @@ -585,7 +589,7 @@ static bool simplifyLoopCFG(Loop &L, DominatorTree &DT, LoopInfo &LI, bool Changed = false; // Constant-fold terminators with known constant conditions. - Changed |= constantFoldTerminators(L, DT, LI, MSSAU); + Changed |= constantFoldTerminators(L, DT, LI, SE, MSSAU); // Eliminate unconditional branches by merging blocks into their predecessors. Changed |= mergeBlocksIntoPredecessors(L, DT, LI, MSSAU); |

