Fix Regression/Transforms/LoopUnswitch/2006-02-22-UnswitchCrash.ll, which

caused SPASS to fail building last night.

We can't trivially unswitch a loop if the exit block has phi nodes in it,
because we don't know which predecessor to use.

llvm-svn: 26320
This commit is contained in:
Chris Lattner 2006-02-22 23:55:00 +00:00
parent a61d2e8878
commit e5521db5bc
1 changed files with 3 additions and 1 deletions

View File

@ -325,7 +325,9 @@ static bool IsTrivialUnswitchCondition(Loop *L, Value *Cond, Constant **Val = 0,
}
}
if (!LoopExitBB)
// If we didn't find a single unique LoopExit block, or if the loop exit block
// contains phi nodes, this isn't trivial.
if (!LoopExitBB || isa<PHINode>(LoopExitBB->begin()))
return false; // Can't handle this.
if (LoopExit) *LoopExit = LoopExitBB;