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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198503 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alp Toker
2014-01-04 17:00:45 +00:00
parent 72d2b05254
commit ccd36c4c54
3 changed files with 10 additions and 104 deletions

View File

@@ -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);