diff options
author | Devang Patel <dpatel@apple.com> | 2007-09-11 00:12:56 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2007-09-11 00:12:56 +0000 |
commit | 4f12c5f615ed9aa87a874b7cfa7ec4049f7e44d1 (patch) | |
tree | 9be083ac8a9786b5b91c2352eb4907f3a3ab8e4f /lib/Transforms | |
parent | ba32a5f3ccddcae38e96f7f73fa35f0228f4070c (diff) | |
download | external_llvm-4f12c5f615ed9aa87a874b7cfa7ec4049f7e44d1.zip external_llvm-4f12c5f615ed9aa87a874b7cfa7ec4049f7e44d1.tar.gz external_llvm-4f12c5f615ed9aa87a874b7cfa7ec4049f7e44d1.tar.bz2 |
Split condition does not have to be ICmpInst in all cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41822 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/LoopIndexSplit.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp index 03f1553..f4be5dd 100644 --- a/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/lib/Transforms/Scalar/LoopIndexSplit.cpp @@ -64,8 +64,8 @@ namespace { // Induction variable's range is split at this value. Value *SplitValue; - // This compare instruction compares IndVar against SplitValue. - ICmpInst *SplitCondition; + // This instruction compares IndVar against SplitValue. + Instruction *SplitCondition; // True if after loop index split, first loop will execute split condition's // true branch. @@ -221,7 +221,8 @@ bool LoopIndexSplit::runOnLoop(Loop *IncomingLoop, LPPassManager &LPM_Ref) { for (SmallVector<SplitInfo, 4>::iterator SI = SplitData.begin(), E = SplitData.end(); SI != E;) { SplitInfo &SD = *SI; - if (SD.SplitCondition->getPredicate() == ICmpInst::ICMP_EQ) { + ICmpInst *CI = dyn_cast<ICmpInst>(SD.SplitCondition); + if (CI && CI->getPredicate() == ICmpInst::ICMP_EQ) { Changed = processOneIterationLoop(SD); if (Changed) { ++NumIndexSplit; @@ -790,7 +791,8 @@ bool LoopIndexSplit::safeSplitCondition(SplitInfo &SD) { /// based on split value. void LoopIndexSplit::calculateLoopBounds(SplitInfo &SD) { - ICmpInst::Predicate SP = SD.SplitCondition->getPredicate(); + ICmpInst *SC = cast<ICmpInst>(SD.SplitCondition); + ICmpInst::Predicate SP = SC->getPredicate(); const Type *Ty = SD.SplitValue->getType(); bool Sign = ExitCondition->isSignedPredicate(); BasicBlock *Preheader = L->getLoopPreheader(); @@ -1140,7 +1142,8 @@ bool LoopIndexSplit::splitLoop(SplitInfo &SD) { ICmpInst *B_SplitCondition = cast<ICmpInst>(ValueMap[SD.SplitCondition]); moveExitCondition(A_SplitCondBlock, A_ActiveBranch, A_ExitBlock, ExitCondition, - SD.SplitCondition, IndVar, IndVarIncrement, ALoop); + cast<ICmpInst>(SD.SplitCondition), IndVar, IndVarIncrement, + ALoop); moveExitCondition(B_SplitCondBlock, B_ActiveBranch, B_ExitBlock, B_ExitCondition, B_SplitCondition, B_IndVar, B_IndVarIncrement, BLoop); |