diff options
Diffstat (limited to 'lib/Transforms/Scalar/LoopIndexSplit.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopIndexSplit.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp index 6698d67f91..d31a589a78 100644 --- a/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/lib/Transforms/Scalar/LoopIndexSplit.cpp @@ -301,23 +301,23 @@ void LoopIndexSplit::findIndVar(Value *V, Loop *L) { Value *Op0 = I->getOperand(0); Value *Op1 = I->getOperand(1); - if (PHINode *PN = dyn_cast<PHINode>(Op0)) { - if (PN->getParent() == L->getHeader() - && isa<ConstantInt>(Op1)) { - IndVar = PN; - IndVarIncrement = I; - return; - } - } - - if (PHINode *PN = dyn_cast<PHINode>(Op1)) { - if (PN->getParent() == L->getHeader() - && isa<ConstantInt>(Op0)) { - IndVar = PN; - IndVarIncrement = I; - return; - } - } + if (PHINode *PN = dyn_cast<PHINode>(Op0)) + if (PN->getParent() == L->getHeader()) + if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) + if (CI->isOne()) { + IndVar = PN; + IndVarIncrement = I; + return; + } + + if (PHINode *PN = dyn_cast<PHINode>(Op1)) + if (PN->getParent() == L->getHeader()) + if (ConstantInt *CI = dyn_cast<ConstantInt>(Op0)) + if (CI->isOne()) { + IndVar = PN; + IndVarIncrement = I; + return; + } return; } |