diff options
author | Alp Toker <alp@nuanti.com> | 2014-01-04 17:00:45 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2014-01-04 17:00:45 +0000 |
commit | 5e9f3265f85e21a673f81381a4beba4bfb5bce51 (patch) | |
tree | 1accb9562918698b316c9a91686783a221dd1bf2 /llvm/lib/Transforms/Utils/LoopSimplify.cpp | |
parent | 59226f7811f37533460058a16e6dbf070a2254e9 (diff) | |
download | bcm5719-llvm-5e9f3265f85e21a673f81381a4beba4bfb5bce51.tar.gz bcm5719-llvm-5e9f3265f85e21a673f81381a4beba4bfb5bce51.zip |
Revert "Fix PR18361: Invalidate LoopDispositions after LoopSimplify hoists things."
This commit was the source of crasher PR18384:
While deleting: label %for.cond127
An asserting value handle still pointed to this value!
UNREACHABLE executed at llvm/lib/IR/Value.cpp:671!
Reverting to get the builders green, feel free to re-land after fixing up.
(Renato has a handy isolated repro if you need it.)
This reverts commit r198478.
llvm-svn: 198503
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopSimplify.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopSimplify.cpp | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp index 1927d288d43..6d5f16ca333 100644 --- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp +++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp @@ -309,7 +309,6 @@ ReprocessLoop: // Attempt to hoist out all instructions except for the // comparison and the branch. bool AllInvariant = true; - bool AnyInvariant = false; for (BasicBlock::iterator I = ExitingBlock->begin(); &*I != BI; ) { Instruction *Inst = I++; // Skip debug info intrinsics. @@ -317,26 +316,12 @@ ReprocessLoop: continue; if (Inst == CI) continue; - if (!L->makeLoopInvariant(Inst, AnyInvariant, - Preheader ? Preheader->getTerminator() : 0)) { + if (!L->makeLoopInvariant(Inst, Changed, + Preheader ? Preheader->getTerminator() : 0)) { AllInvariant = false; break; } } - if (AnyInvariant) { - Changed = true; - // If any reachable control flow within this loop has changed, notify - // ScalarEvolution. Currently assume the parent loop doesn't change - // (spliting edges doesn't count). If blocks, CFG edges, or other values - // in the parent loop change, then we need call to forgetLoop() for the - // parent instead. - if (SE) { - SE->forgetLoop(L); - // The loop disposition of all SCEV expressions that depend on any - // hoisted values have also changed. - SE->forgetLoopDispositions(L); - } - } if (!AllInvariant) continue; // The block has now been cleared of all instructions except for @@ -349,6 +334,14 @@ ReprocessLoop: DEBUG(dbgs() << "LoopSimplify: Eliminating exiting block " << ExitingBlock->getName() << "\n"); + // If any reachable control flow within this loop has changed, notify + // ScalarEvolution. Currently assume the parent loop doesn't change + // (spliting edges doesn't count). If blocks, CFG edges, or other values + // in the parent loop change, then we need call to forgetLoop() for the + // parent instead. + if (SE) + SE->forgetLoop(L); + assert(pred_begin(ExitingBlock) == pred_end(ExitingBlock)); Changed = true; LI->removeBlock(ExitingBlock); |