[llvm-commits] [llvm] r69842 - /llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp

Evan Cheng evan.cheng at apple.com
Wed Apr 22 16:09:17 PDT 2009


Author: evancheng
Date: Wed Apr 22 18:09:16 2009
New Revision: 69842

URL: http://llvm.org/viewvc/llvm-project?rev=69842&view=rev
Log:
A few more places where the check of use_empty is needed.

Modified:
    llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=69842&r1=69841&r2=69842&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Wed Apr 22 18:09:16 2009
@@ -739,6 +739,7 @@
         // 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 @@
         // 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 @@
           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());





More information about the llvm-commits mailing list