diff options
| author | Devang Patel <dpatel@apple.com> | 2008-01-29 02:20:41 +0000 | 
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2008-01-29 02:20:41 +0000 | 
| commit | 67fa0521b6c5033bf11f1b22f81bbf76daabb9ea (patch) | |
| tree | e74608bc121e21806bab0ac4d91380897186677d /llvm/lib/Transforms/Scalar | |
| parent | ceae3bbf4dd5e3a6fc7e52fbce10d75abbc70af2 (diff) | |
| download | bcm5719-llvm-67fa0521b6c5033bf11f1b22f81bbf76daabb9ea.tar.gz bcm5719-llvm-67fa0521b6c5033bf11f1b22f81bbf76daabb9ea.zip | |
Filter loops that subtract induction variables.
These loops are not yet handled.
Fix PR 1912.
llvm-svn: 46484
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp | 34 | 
1 files changed, 17 insertions, 17 deletions
| diff --git a/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp b/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp index 6698d67f91e..d31a589a78e 100644 --- a/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/llvm/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;  } | 

