diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2009-04-22 23:09:16 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2009-04-22 23:09:16 +0000 |
| commit | 59ca33053b092cfe3d166b5044d9509e608ee306 (patch) | |
| tree | 8716c49bd6a09dcb16298ec00d2821ec104baeb5 /llvm/lib/Transforms | |
| parent | 6df69867c31c7057f5dc89ac13c93b176bb577f6 (diff) | |
| download | bcm5719-llvm-59ca33053b092cfe3d166b5044d9509e608ee306.tar.gz bcm5719-llvm-59ca33053b092cfe3d166b5044d9509e608ee306.zip | |
A few more places where the check of use_empty is needed.
llvm-svn: 69842
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index b1cde4177bf..1dd84b1816b 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -739,6 +739,7 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) { // See if we can figure out sext(i+constant) doesn't wrap, so we can // use a larger add. This is common in subscripting. if (UInst && UInst->getOpcode()==Instruction::Add && + !UInst->use_empty() && allUsesAreSameTyped(Instruction::SExt, UInst) && isa<ConstantInt>(UInst->getOperand(1)) && NoSignedWrap && LimitVal) { @@ -771,6 +772,7 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) { // Try for sext(i | constant). This is safe as long as the // high bit of the constant is not set. if (UInst && UInst->getOpcode()==Instruction::Or && + !UInst->use_empty() && allUsesAreSameTyped(Instruction::SExt, UInst) && NoSignedWrap && isa<ConstantInt>(UInst->getOperand(1))) { ConstantInt* RHS = dyn_cast<ConstantInt>(UInst->getOperand(1)); @@ -841,6 +843,7 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) { ConstantInt* AddRHS = dyn_cast<ConstantInt>(UInst->getOperand(1)); Instruction *UInst2 = dyn_cast<Instruction>(UInst->use_begin()); if (UInst2 && UInst2->getOpcode() == Instruction::And && + !UInst2->use_empty() && allUsesAreSameTyped(Instruction::ZExt, UInst2) && isa<ConstantInt>(UInst2->getOperand(1))) { ZExtInst* oldZext = dyn_cast<ZExtInst>(UInst2->use_begin()); |

