[llvm] r183328 - Use IRBuilder instead of ConstantInt methods. It simplifies code a little bit.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Jun 6 10:10:53 PDT 2013


This broke the dragonegg bots. I have reverted it and reported
http://llvm.org/bugs/show_bug.cgi?id=16244 with what I found. There is
only one difference with and without this patch, so it should be easy
to find what the error was.

On 5 June 2013 14:27, Jakub Staszak <kubastaszak at gmail.com> wrote:
> Author: kuba
> Date: Wed Jun  5 13:27:02 2013
> New Revision: 183328
>
> URL: http://llvm.org/viewvc/llvm-project?rev=183328&view=rev
> Log:
> Use IRBuilder instead of ConstantInt methods. It simplifies code a little bit.
>
> Modified:
>     llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=183328&r1=183327&r2=183328&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Wed Jun  5 13:27:02 2013
> @@ -402,7 +402,7 @@ FoldCmpLoadFromIndexedGlobal(GetElementP
>    if (SecondTrueElement != Overdefined) {
>      // None true -> false.
>      if (FirstTrueElement == Undefined)
> -      return ReplaceInstUsesWith(ICI, ConstantInt::getFalse(GEP->getContext()));
> +      return ReplaceInstUsesWith(ICI, Builder->getFalse());
>
>      Value *FirstTrueIdx = ConstantInt::get(Idx->getType(), FirstTrueElement);
>
> @@ -422,7 +422,7 @@ FoldCmpLoadFromIndexedGlobal(GetElementP
>    if (SecondFalseElement != Overdefined) {
>      // None false -> true.
>      if (FirstFalseElement == Undefined)
> -      return ReplaceInstUsesWith(ICI, ConstantInt::getTrue(GEP->getContext()));
> +      return ReplaceInstUsesWith(ICI, Builder->getTrue());
>
>      Value *FirstFalseIdx = ConstantInt::get(Idx->getType(), FirstFalseElement);
>
> @@ -710,10 +710,8 @@ Instruction *InstCombiner::FoldGEPICmp(G
>            }
>          }
>
> -      if (NumDifferences == 0)   // SAME GEP?
> -        return ReplaceInstUsesWith(I, // No comparison is needed here.
> -                               ConstantInt::get(Type::getInt1Ty(I.getContext()),
> -                                             ICmpInst::isTrueWhenEqual(Cond)));
> +      if (NumDifferences == 0)   // SAME GEP? No comparison is needed here.
> +        return ReplaceInstUsesWith(I, Builder->getInt1(Cond));
>
>        else if (NumDifferences == 1 && GEPsInBounds) {
>          Value *LHSV = GEPLHS->getOperand(DiffOperand);
> @@ -752,11 +750,11 @@ Instruction *InstCombiner::FoldICmpAddOp
>
>    // (X+4) == X -> false.
>    if (Pred == ICmpInst::ICMP_EQ)
> -    return ReplaceInstUsesWith(ICI, ConstantInt::getFalse(X->getContext()));
> +    return ReplaceInstUsesWith(ICI, Builder->getFalse());
>
>    // (X+4) != X -> true.
>    if (Pred == ICmpInst::ICMP_NE)
> -    return ReplaceInstUsesWith(ICI, ConstantInt::getTrue(X->getContext()));
> +    return ReplaceInstUsesWith(ICI, Builder->getTrue());
>
>    // From this point on, we know that (X+C <= X) --> (X+C < X) because C != 0,
>    // so the values can never be equal.  Similarly for all other "or equals"
> @@ -798,7 +796,7 @@ Instruction *InstCombiner::FoldICmpAddOp
>    // (X+ -1) >s X      --> X <s (MAXSINT-(-1-1))      --> X == -128
>
>    assert(Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SGE);
> -  Constant *C = ConstantInt::get(X->getContext(), CI->getValue()-1);
> +  Constant *C = Builder->getInt(CI->getValue()-1);
>    return new ICmpInst(ICmpInst::ICMP_SLT, X, ConstantExpr::getSub(SMax, C));
>  }
>
> @@ -921,7 +919,7 @@ Instruction *InstCombiner::FoldICmpDivCs
>    default: llvm_unreachable("Unhandled icmp opcode!");
>    case ICmpInst::ICMP_EQ:
>      if (LoOverflow && HiOverflow)
> -      return ReplaceInstUsesWith(ICI, ConstantInt::getFalse(ICI.getContext()));
> +      return ReplaceInstUsesWith(ICI, Builder->getFalse());
>      if (HiOverflow)
>        return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE :
>                            ICmpInst::ICMP_UGE, X, LoBound);
> @@ -932,7 +930,7 @@ Instruction *InstCombiner::FoldICmpDivCs
>                                                      DivIsSigned, true));
>    case ICmpInst::ICMP_NE:
>      if (LoOverflow && HiOverflow)
> -      return ReplaceInstUsesWith(ICI, ConstantInt::getTrue(ICI.getContext()));
> +      return ReplaceInstUsesWith(ICI, Builder->getTrue());
>      if (HiOverflow)
>        return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT :
>                            ICmpInst::ICMP_ULT, X, LoBound);
> @@ -944,16 +942,16 @@ Instruction *InstCombiner::FoldICmpDivCs
>    case ICmpInst::ICMP_ULT:
>    case ICmpInst::ICMP_SLT:
>      if (LoOverflow == +1)   // Low bound is greater than input range.
> -      return ReplaceInstUsesWith(ICI, ConstantInt::getTrue(ICI.getContext()));
> +      return ReplaceInstUsesWith(ICI, Builder->getTrue());
>      if (LoOverflow == -1)   // Low bound is less than input range.
> -      return ReplaceInstUsesWith(ICI, ConstantInt::getFalse(ICI.getContext()));
> +      return ReplaceInstUsesWith(ICI, Builder->getFalse());
>      return new ICmpInst(Pred, X, LoBound);
>    case ICmpInst::ICMP_UGT:
>    case ICmpInst::ICMP_SGT:
>      if (HiOverflow == +1)       // High bound greater than input range.
> -      return ReplaceInstUsesWith(ICI, ConstantInt::getFalse(ICI.getContext()));
> +      return ReplaceInstUsesWith(ICI, Builder->getFalse());
>      if (HiOverflow == -1)       // High bound less than input range.
> -      return ReplaceInstUsesWith(ICI, ConstantInt::getTrue(ICI.getContext()));
> +      return ReplaceInstUsesWith(ICI, Builder->getTrue());
>      if (Pred == ICmpInst::ICMP_UGT)
>        return new ICmpInst(ICmpInst::ICMP_UGE, X, HiBound);
>      return new ICmpInst(ICmpInst::ICMP_SGE, X, HiBound);
> @@ -1017,7 +1015,7 @@ Instruction *InstCombiner::FoldICmpShrCs
>    // If we are comparing against bits always shifted out, the
>    // comparison cannot succeed.
>    APInt Comp = CmpRHSV << ShAmtVal;
> -  ConstantInt *ShiftedCmpRHS = ConstantInt::get(ICI.getContext(), Comp);
> +  ConstantInt *ShiftedCmpRHS = Builder->getInt(Comp);
>    if (Shr->getOpcode() == Instruction::LShr)
>      Comp = Comp.lshr(ShAmtVal);
>    else
> @@ -1025,8 +1023,7 @@ Instruction *InstCombiner::FoldICmpShrCs
>
>    if (Comp != CmpRHSV) { // Comparing against a bit that we know is zero.
>      bool IsICMP_NE = ICI.getPredicate() == ICmpInst::ICMP_NE;
> -    Constant *Cst = ConstantInt::get(Type::getInt1Ty(ICI.getContext()),
> -                                     IsICMP_NE);
> +    Constant *Cst = Builder->getInt1(IsICMP_NE);
>      return ReplaceInstUsesWith(ICI, Cst);
>    }
>
> @@ -1039,7 +1036,7 @@ Instruction *InstCombiner::FoldICmpShrCs
>    if (Shr->hasOneUse()) {
>      // Otherwise strength reduce the shift into an and.
>      APInt Val(APInt::getHighBitsSet(TypeBits, TypeBits - ShAmtVal));
> -    Constant *Mask = ConstantInt::get(ICI.getContext(), Val);
> +    Constant *Mask = Builder->getInt(Val);
>
>      Value *And = Builder->CreateAnd(Shr->getOperand(0),
>                                      Mask, Shr->getName()+".mask");
> @@ -1072,7 +1069,7 @@ Instruction *InstCombiner::visitICmpInst
>          APInt NewRHS = RHS->getValue().zext(SrcBits);
>          NewRHS |= KnownOne & APInt::getHighBitsSet(SrcBits, SrcBits-DstBits);
>          return new ICmpInst(ICI.getPredicate(), LHSI->getOperand(0),
> -                            ConstantInt::get(ICI.getContext(), NewRHS));
> +                            Builder->getInt(NewRHS));
>        }
>      }
>      break;
> @@ -1115,8 +1112,7 @@ Instruction *InstCombiner::visitICmpInst
>                                           ? ICI.getUnsignedPredicate()
>                                           : ICI.getSignedPredicate();
>            return new ICmpInst(Pred, LHSI->getOperand(0),
> -                              ConstantInt::get(ICI.getContext(),
> -                                               RHSV ^ SignBit));
> +                              Builder->getInt(RHSV ^ SignBit));
>          }
>
>          // (icmp u/s (xor A ~SignBit), C) -> (icmp s/u (xor C ~SignBit), A)
> @@ -1127,8 +1123,7 @@ Instruction *InstCombiner::visitICmpInst
>                                           : ICI.getSignedPredicate();
>            Pred = ICI.getSwappedPredicate(Pred);
>            return new ICmpInst(Pred, LHSI->getOperand(0),
> -                              ConstantInt::get(ICI.getContext(),
> -                                               RHSV ^ NotSignBit));
> +                              Builder->getInt(RHSV ^ NotSignBit));
>          }
>        }
>      }
> @@ -1218,11 +1213,9 @@ Instruction *InstCombiner::visitICmpInst
>              // As a special case, check to see if this means that the
>              // result is always true or false now.
>              if (ICI.getPredicate() == ICmpInst::ICMP_EQ)
> -              return ReplaceInstUsesWith(ICI,
> -                                       ConstantInt::getFalse(ICI.getContext()));
> +              return ReplaceInstUsesWith(ICI, Builder->getFalse());
>              if (ICI.getPredicate() == ICmpInst::ICMP_NE)
> -              return ReplaceInstUsesWith(ICI,
> -                                       ConstantInt::getTrue(ICI.getContext()));
> +              return ReplaceInstUsesWith(ICI, Builder->getTrue());
>            } else {
>              ICI.setOperand(1, NewCst);
>              Constant *NewAndCST;
> @@ -1344,8 +1337,7 @@ Instruction *InstCombiner::visitICmpInst
>                                                                   ShAmt);
>        if (Comp != RHS) {// Comparing against a bit that we know is zero.
>          bool IsICMP_NE = ICI.getPredicate() == ICmpInst::ICMP_NE;
> -        Constant *Cst =
> -          ConstantInt::get(Type::getInt1Ty(ICI.getContext()), IsICMP_NE);
> +        Constant *Cst = Builder->getInt1(IsICMP_NE);
>          return ReplaceInstUsesWith(ICI, Cst);
>        }
>
> @@ -1364,9 +1356,8 @@ Instruction *InstCombiner::visitICmpInst
>        if (LHSI->hasOneUse()) {
>          // Otherwise strength reduce the shift into an and.
>          uint32_t ShAmtVal = (uint32_t)ShAmt->getLimitedValue(TypeBits);
> -        Constant *Mask =
> -          ConstantInt::get(ICI.getContext(), APInt::getLowBitsSet(TypeBits,
> -                                                       TypeBits-ShAmtVal));
> +        Constant *Mask = Builder->getInt(APInt::getLowBitsSet(TypeBits,
> +                                                          TypeBits - ShAmtVal));
>
>          Value *And =
>            Builder->CreateAnd(LHSI->getOperand(0),Mask, LHSI->getName()+".mask");
> @@ -1464,18 +1455,18 @@ Instruction *InstCombiner::visitICmpInst
>        if (ICI.isSigned()) {
>          if (CR.getLower().isSignBit()) {
>            return new ICmpInst(ICmpInst::ICMP_SLT, LHSI->getOperand(0),
> -                              ConstantInt::get(ICI.getContext(),CR.getUpper()));
> +                              Builder->getInt(CR.getUpper()));
>          } else if (CR.getUpper().isSignBit()) {
>            return new ICmpInst(ICmpInst::ICMP_SGE, LHSI->getOperand(0),
> -                              ConstantInt::get(ICI.getContext(),CR.getLower()));
> +                              Builder->getInt(CR.getLower()));
>          }
>        } else {
>          if (CR.getLower().isMinValue()) {
>            return new ICmpInst(ICmpInst::ICMP_ULT, LHSI->getOperand(0),
> -                              ConstantInt::get(ICI.getContext(),CR.getUpper()));
> +                              Builder->getInt(CR.getUpper()));
>          } else if (CR.getUpper().isMinValue()) {
>            return new ICmpInst(ICmpInst::ICMP_UGE, LHSI->getOperand(0),
> -                              ConstantInt::get(ICI.getContext(),CR.getLower()));
> +                              Builder->getInt(CR.getLower()));
>          }
>        }
>      }
> @@ -1555,9 +1546,7 @@ Instruction *InstCombiner::visitICmpInst
>          if (ConstantInt *BOC = dyn_cast<ConstantInt>(BO->getOperand(1))) {
>            Constant *NotCI = ConstantExpr::getNot(RHS);
>            if (!ConstantExpr::getAnd(BOC, NotCI)->isNullValue())
> -            return ReplaceInstUsesWith(ICI,
> -                             ConstantInt::get(Type::getInt1Ty(ICI.getContext()),
> -                                       isICMP_NE));
> +            return ReplaceInstUsesWith(ICI, Builder->getInt1(isICMP_NE));
>          }
>          break;
>
> @@ -1566,9 +1555,7 @@ Instruction *InstCombiner::visitICmpInst
>            // If bits are being compared against that are and'd out, then the
>            // comparison can never succeed!
>            if ((RHSV & ~BOC->getValue()) != 0)
> -            return ReplaceInstUsesWith(ICI,
> -                             ConstantInt::get(Type::getInt1Ty(ICI.getContext()),
> -                                       isICMP_NE));
> +            return ReplaceInstUsesWith(ICI, Builder->getInt1(isICMP_NE));
>
>            // If we have ((X & C) == C), turn it into ((X & C) != 0).
>            if (RHS == BOC && RHSV.isPowerOf2())
> @@ -1619,7 +1606,7 @@ Instruction *InstCombiner::visitICmpInst
>        case Intrinsic::bswap:
>          Worklist.Add(II);
>          ICI.setOperand(0, II->getArgOperand(0));
> -        ICI.setOperand(1, ConstantInt::get(II->getContext(), RHSV.byteSwap()));
> +        ICI.setOperand(1, Builder->getInt(RHSV.byteSwap()));
>          return &ICI;
>        case Intrinsic::ctlz:
>        case Intrinsic::cttz:
> @@ -2041,19 +2028,19 @@ Instruction *InstCombiner::visitICmpInst
>      case ICmpInst::ICMP_ULE:
>        assert(!CI->isMaxValue(false));                 // A <=u MAX -> TRUE
>        return new ICmpInst(ICmpInst::ICMP_ULT, Op0,
> -                          ConstantInt::get(CI->getContext(), CI->getValue()+1));
> +                          Builder->getInt(CI->getValue()+1));
>      case ICmpInst::ICMP_SLE:
>        assert(!CI->isMaxValue(true));                  // A <=s MAX -> TRUE
>        return new ICmpInst(ICmpInst::ICMP_SLT, Op0,
> -                          ConstantInt::get(CI->getContext(), CI->getValue()+1));
> +                          Builder->getInt(CI->getValue()+1));
>      case ICmpInst::ICMP_UGE:
>        assert(!CI->isMinValue(false));                 // A >=u MIN -> TRUE
>        return new ICmpInst(ICmpInst::ICMP_UGT, Op0,
> -                          ConstantInt::get(CI->getContext(), CI->getValue()-1));
> +                          Builder->getInt(CI->getValue()-1));
>      case ICmpInst::ICMP_SGE:
>        assert(!CI->isMinValue(true));                  // A >=s MIN -> TRUE
>        return new ICmpInst(ICmpInst::ICMP_SGT, Op0,
> -                          ConstantInt::get(CI->getContext(), CI->getValue()-1));
> +                          Builder->getInt(CI->getValue()-1));
>      }
>
>      // If this comparison is a normal comparison, it demands all
> @@ -2192,7 +2179,7 @@ Instruction *InstCombiner::visitICmpInst
>        if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
>          if (Op1Max == Op0Min+1)        // A <u C -> A == C-1 if min(A)+1 == C
>            return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
> -                          ConstantInt::get(CI->getContext(), CI->getValue()-1));
> +                              Builder->getInt(CI->getValue()-1));
>
>          // (x <u 2147483648) -> (x >s -1)  -> true if sign bit clear
>          if (CI->isMinValue(true))
> @@ -2211,7 +2198,7 @@ Instruction *InstCombiner::visitICmpInst
>        if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
>          if (Op1Min == Op0Max-1)        // A >u C -> A == C+1 if max(a)-1 == C
>            return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
> -                          ConstantInt::get(CI->getContext(), CI->getValue()+1));
> +                              Builder->getInt(CI->getValue()+1));
>
>          // (x >u 2147483647) -> (x <s 0)  -> true if sign bit set
>          if (CI->isMaxValue(true))
> @@ -2229,7 +2216,7 @@ Instruction *InstCombiner::visitICmpInst
>        if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
>          if (Op1Max == Op0Min+1)        // A <s C -> A == C-1 if min(A)+1 == C
>            return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
> -                          ConstantInt::get(CI->getContext(), CI->getValue()-1));
> +                              Builder->getInt(CI->getValue()-1));
>        }
>        break;
>      case ICmpInst::ICMP_SGT:
> @@ -2243,7 +2230,7 @@ Instruction *InstCombiner::visitICmpInst
>        if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
>          if (Op1Min == Op0Max-1)        // A >s C -> A == C+1 if max(A)-1 == C
>            return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
> -                          ConstantInt::get(CI->getContext(), CI->getValue()+1));
> +                              Builder->getInt(CI->getValue()+1));
>        }
>        break;
>      case ICmpInst::ICMP_SGE:
> @@ -2719,8 +2706,7 @@ Instruction *InstCombiner::visitICmpInst
>          ConstantInt *C1, *C2;
>          if (match(B, m_ConstantInt(C1)) &&
>              match(D, m_ConstantInt(C2)) && Op1->hasOneUse()) {
> -          Constant *NC = ConstantInt::get(I.getContext(),
> -                                          C1->getValue() ^ C2->getValue());
> +          Constant *NC = Builder->getInt(C1->getValue() ^ C2->getValue());
>            Value *Xor = Builder->CreateXor(C, NC);
>            return new ICmpInst(I.getPredicate(), A, Xor);
>          }
> @@ -2885,9 +2871,9 @@ Instruction *InstCombiner::FoldFCmp_IntT
>      Pred = ICmpInst::ICMP_NE;
>      break;
>    case FCmpInst::FCMP_ORD:
> -    return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
> +    return ReplaceInstUsesWith(I, Builder->getTrue());
>    case FCmpInst::FCMP_UNO:
> -    return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
> +    return ReplaceInstUsesWith(I, Builder->getTrue());
>    }
>
>    IntegerType *IntTy = cast<IntegerType>(LHSI->getOperand(0)->getType());
> @@ -2907,8 +2893,8 @@ Instruction *InstCombiner::FoldFCmp_IntT
>      if (SMax.compare(RHS) == APFloat::cmpLessThan) {  // smax < 13123.0
>        if (Pred == ICmpInst::ICMP_NE  || Pred == ICmpInst::ICMP_SLT ||
>            Pred == ICmpInst::ICMP_SLE)
> -        return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
> -      return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
> +        return ReplaceInstUsesWith(I, Builder->getTrue());
> +      return ReplaceInstUsesWith(I, Builder->getFalse());
>      }
>    } else {
>      // If the RHS value is > UnsignedMax, fold the comparison. This handles
> @@ -2919,8 +2905,8 @@ Instruction *InstCombiner::FoldFCmp_IntT
>      if (UMax.compare(RHS) == APFloat::cmpLessThan) {  // umax < 13123.0
>        if (Pred == ICmpInst::ICMP_NE  || Pred == ICmpInst::ICMP_ULT ||
>            Pred == ICmpInst::ICMP_ULE)
> -        return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
> -      return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
> +        return ReplaceInstUsesWith(I, Builder->getTrue());
> +      return ReplaceInstUsesWith(I, Builder->getFalse());
>      }
>    }
>
> @@ -2932,8 +2918,8 @@ Instruction *InstCombiner::FoldFCmp_IntT
>      if (SMin.compare(RHS) == APFloat::cmpGreaterThan) { // smin > 12312.0
>        if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_SGT ||
>            Pred == ICmpInst::ICMP_SGE)
> -        return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
> -      return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
> +        return ReplaceInstUsesWith(I, Builder->getTrue());
> +      return ReplaceInstUsesWith(I, Builder->getFalse());
>      }
>    } else {
>      // See if the RHS value is < UnsignedMin.
> @@ -2943,8 +2929,8 @@ Instruction *InstCombiner::FoldFCmp_IntT
>      if (SMin.compare(RHS) == APFloat::cmpGreaterThan) { // umin > 12312.0
>        if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_UGT ||
>            Pred == ICmpInst::ICMP_UGE)
> -        return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
> -      return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
> +        return ReplaceInstUsesWith(I, Builder->getTrue());
> +      return ReplaceInstUsesWith(I, Builder->getFalse());
>      }
>    }
>
> @@ -2966,14 +2952,14 @@ Instruction *InstCombiner::FoldFCmp_IntT
>        switch (Pred) {
>        default: llvm_unreachable("Unexpected integer comparison!");
>        case ICmpInst::ICMP_NE:  // (float)int != 4.4   --> true
> -        return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
> +        return ReplaceInstUsesWith(I, Builder->getTrue());
>        case ICmpInst::ICMP_EQ:  // (float)int == 4.4   --> false
> -        return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
> +        return ReplaceInstUsesWith(I, Builder->getFalse());
>        case ICmpInst::ICMP_ULE:
>          // (float)int <= 4.4   --> int <= 4
>          // (float)int <= -4.4  --> false
>          if (RHS.isNegative())
> -          return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
> +          return ReplaceInstUsesWith(I, Builder->getFalse());
>          break;
>        case ICmpInst::ICMP_SLE:
>          // (float)int <= 4.4   --> int <= 4
> @@ -2985,7 +2971,7 @@ Instruction *InstCombiner::FoldFCmp_IntT
>          // (float)int < -4.4   --> false
>          // (float)int < 4.4    --> int <= 4
>          if (RHS.isNegative())
> -          return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
> +          return ReplaceInstUsesWith(I, Builder->getFalse());
>          Pred = ICmpInst::ICMP_ULE;
>          break;
>        case ICmpInst::ICMP_SLT:
> @@ -2998,7 +2984,7 @@ Instruction *InstCombiner::FoldFCmp_IntT
>          // (float)int > 4.4    --> int > 4
>          // (float)int > -4.4   --> true
>          if (RHS.isNegative())
> -          return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
> +          return ReplaceInstUsesWith(I, Builder->getTrue());
>          break;
>        case ICmpInst::ICMP_SGT:
>          // (float)int > 4.4    --> int > 4
> @@ -3010,7 +2996,7 @@ Instruction *InstCombiner::FoldFCmp_IntT
>          // (float)int >= -4.4   --> true
>          // (float)int >= 4.4    --> int > 4
>          if (RHS.isNegative())
> -          return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
> +          return ReplaceInstUsesWith(I, Builder->getTrue());
>          Pred = ICmpInst::ICMP_UGT;
>          break;
>        case ICmpInst::ICMP_SGE:
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list