// First see if it is possible to eliminate loop itself or not.
for (SmallVector<SplitInfo, 4>::iterator SI = SplitData.begin(),
- E = SplitData.end(); SI != E; ++SI) {
+ E = SplitData.end(); SI != E;) {
SplitInfo &SD = *SI;
if (SD.SplitCondition->getPredicate() == ICmpInst::ICMP_EQ) {
Changed = processOneIterationLoop(SD);
++NumIndexSplit;
// If is loop is eliminated then nothing else to do here.
return Changed;
+ } else {
+ SmallVector<SplitInfo, 4>::iterator Delete_SI = SI;
+ ++SI;
+ SplitData.erase(Delete_SI);
}
- }
+ } else
+ ++SI;
}
unsigned MaxCost = 99;
SplitInfo SD = *SI;
// ICM_EQs are already handled above.
- if (SD.SplitCondition->getPredicate() == ICmpInst::ICMP_EQ)
- continue;
+ assert (SD.SplitCondition->getPredicate() != ICmpInst::ICMP_EQ &&
+ "Unexpected split condition predicate");
unsigned Cost = findSplitCost(L, SD);
if (Cost < MaxCost)
}
// Split most profitiable condition.
- Changed = splitLoop(SplitData[MostProfitableSDIndex]);
+ if (!SplitData.empty())
+ Changed = splitLoop(SplitData[MostProfitableSDIndex]);
if (Changed)
++NumIndexSplit;
-; RUN: llvm-as < %s | opt -loop-index-split -disable-output -stats |& \
-; RUN: grep "loop-index-split" | count 1
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output
%struct._edit_script = type { %struct._edit_script*, i32, i8 }
-; RUN: llvm-as < %s | opt -loop-index-split -disable-output -stats |& \
-; RUN: grep "loop-index-split" | count 1
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output
%struct._edit_script = type { %struct._edit_script*, i32, i8 }