From: Evan Cheng Date: Wed, 22 Apr 2009 23:09:16 +0000 (+0000) Subject: A few more places where the check of use_empty is needed. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a8d4d7fe47460313e6aaf5cbb73d4bc892202988;p=oota-llvm.git A few more places where the check of use_empty is needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69842 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index b1cde4177bf..1dd84b1816b 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/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(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(UInst->getOperand(1))) { ConstantInt* RHS = dyn_cast(UInst->getOperand(1)); @@ -841,6 +843,7 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) { ConstantInt* AddRHS = dyn_cast(UInst->getOperand(1)); Instruction *UInst2 = dyn_cast(UInst->use_begin()); if (UInst2 && UInst2->getOpcode() == Instruction::And && + !UInst2->use_empty() && allUsesAreSameTyped(Instruction::ZExt, UInst2) && isa(UInst2->getOperand(1))) { ZExtInst* oldZext = dyn_cast(UInst2->use_begin());