diff options
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 6 | 
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index e0a1083b927..4b5891461bc 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -2337,6 +2337,9 @@ Instruction *InstCombiner::foldICmpAddConstant(ICmpInst &Cmp,    Type *Ty = Add->getType();    CmpInst::Predicate Pred = Cmp.getPredicate(); +  if (!Add->hasOneUse()) +    return nullptr; +    // If the add does not wrap, we can always adjust the compare by subtracting    // the constants. Equality comparisons are handled elsewhere. SGE/SLE/UGE/ULE    // are canonicalized to SGT/SLT/UGT/ULT. @@ -2370,9 +2373,6 @@ Instruction *InstCombiner::foldICmpAddConstant(ICmpInst &Cmp,        return new ICmpInst(ICmpInst::ICMP_UGE, X, ConstantInt::get(Ty, Lower));    } -  if (!Add->hasOneUse()) -    return nullptr; -    // X+C <u C2 -> (X & -C2) == C    //   iff C & (C2-1) == 0    //       C2 is a power of 2  | 

