Initialize loop data first.

llvm-svn: 55792
This commit is contained in:
Devang Patel 2008-09-04 20:36:36 +00:00
parent 217836527c
commit 00ec74616b
1 changed files with 1 additions and 2 deletions

View File

@ -418,6 +418,7 @@ unsigned LoopUnswitch::getLoopUnswitchCost(Value *LIC) {
/// unswitch the loop, reprocess the pieces, then return true.
bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val){
initLoopData();
Function *F = loopHeader->getParent();
// Do not unswitch if the function is optimized for size.
@ -441,8 +442,6 @@ bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val){
return false;
}
initLoopData();
Constant *CondVal;
BasicBlock *ExitBlock;
if (IsTrivialUnswitchCondition(LoopCond, &CondVal, &ExitBlock)) {