[llvm-commits] [llvm] r41822 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
Devang Patel
dpatel at apple.com
Mon Sep 10 17:12:57 PDT 2007
Author: dpatel
Date: Mon Sep 10 19:12:56 2007
New Revision: 41822
URL: http://llvm.org/viewvc/llvm-project?rev=41822&view=rev
Log:
Split condition does not have to be ICmpInst in all cases.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=41822&r1=41821&r2=41822&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Mon Sep 10 19:12:56 2007
@@ -64,8 +64,8 @@
// 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 @@
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 @@
/// 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 @@
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);
More information about the llvm-commits
mailing list