[llvm] r183422 - Revert "Use IRBuilder instead of ConstantInt methods. It simplifies code a little bit."
Duncan Sands
duncan.sands at gmail.com
Thu Jun 6 11:55:32 PDT 2013
On 06/06/13 19:03, Rafael Espindola wrote:
> Author: rafael
> Date: Thu Jun 6 12:03:05 2013
> New Revision: 183422
>
> URL: http://llvm.org/viewvc/llvm-project?rev=183422&view=rev
> Log:
> Revert "Use IRBuilder instead of ConstantInt methods. It simplifies code a little bit."
>
> This reverts commit 183328. It caused pr16244 and broke the bots.
I spotted some typos in the patch.
This snippet looks suspicious, it dropped the ICmpInst::isTrueWhenEqual:
@@ -710,10 +710,8 @@
}
}
- 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);
The second part of this snippet inverts the value:
@@ -2885,9 +2871,9 @@
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());
Ciao, Duncan.
>
> 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=183422&r1=183421&r2=183422&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Thu Jun 6 12:03:05 2013
> @@ -402,7 +402,7 @@ FoldCmpLoadFromIndexedGlobal(GetElementP
> if (SecondTrueElement != Overdefined) {
> // None true -> false.
> if (FirstTrueElement == Undefined)
> - return ReplaceInstUsesWith(ICI, Builder->getFalse());
> + return ReplaceInstUsesWith(ICI, ConstantInt::getFalse(GEP->getContext()));
>
> 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, Builder->getTrue());
> + return ReplaceInstUsesWith(ICI, ConstantInt::getTrue(GEP->getContext()));
>
> Value *FirstFalseIdx = ConstantInt::get(Idx->getType(), FirstFalseElement);
>
> @@ -710,8 +710,10 @@ Instruction *InstCombiner::FoldGEPICmp(G
> }
> }
>
> - if (NumDifferences == 0) // SAME GEP? No comparison is needed here.
> - return ReplaceInstUsesWith(I, Builder->getInt1(Cond));
> + if (NumDifferences == 0) // SAME GEP?
> + return ReplaceInstUsesWith(I, // No comparison is needed here.
> + ConstantInt::get(Type::getInt1Ty(I.getContext()),
> + ICmpInst::isTrueWhenEqual(Cond)));
>
> else if (NumDifferences == 1 && GEPsInBounds) {
> Value *LHSV = GEPLHS->getOperand(DiffOperand);
> @@ -750,11 +752,11 @@ Instruction *InstCombiner::FoldICmpAddOp
>
> // (X+4) == X -> false.
> if (Pred == ICmpInst::ICMP_EQ)
> - return ReplaceInstUsesWith(ICI, Builder->getFalse());
> + return ReplaceInstUsesWith(ICI, ConstantInt::getFalse(X->getContext()));
>
> // (X+4) != X -> true.
> if (Pred == ICmpInst::ICMP_NE)
> - return ReplaceInstUsesWith(ICI, Builder->getTrue());
> + return ReplaceInstUsesWith(ICI, ConstantInt::getTrue(X->getContext()));
>
> // 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"
> @@ -796,7 +798,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 = Builder->getInt(CI->getValue()-1);
> + Constant *C = ConstantInt::get(X->getContext(), CI->getValue()-1);
> return new ICmpInst(ICmpInst::ICMP_SLT, X, ConstantExpr::getSub(SMax, C));
> }
>
> @@ -919,7 +921,7 @@ Instruction *InstCombiner::FoldICmpDivCs
> default: llvm_unreachable("Unhandled icmp opcode!");
> case ICmpInst::ICMP_EQ:
> if (LoOverflow && HiOverflow)
> - return ReplaceInstUsesWith(ICI, Builder->getFalse());
> + return ReplaceInstUsesWith(ICI, ConstantInt::getFalse(ICI.getContext()));
> if (HiOverflow)
> return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE :
> ICmpInst::ICMP_UGE, X, LoBound);
> @@ -930,7 +932,7 @@ Instruction *InstCombiner::FoldICmpDivCs
> DivIsSigned, true));
> case ICmpInst::ICMP_NE:
> if (LoOverflow && HiOverflow)
> - return ReplaceInstUsesWith(ICI, Builder->getTrue());
> + return ReplaceInstUsesWith(ICI, ConstantInt::getTrue(ICI.getContext()));
> if (HiOverflow)
> return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT :
> ICmpInst::ICMP_ULT, X, LoBound);
> @@ -942,16 +944,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, Builder->getTrue());
> + return ReplaceInstUsesWith(ICI, ConstantInt::getTrue(ICI.getContext()));
> if (LoOverflow == -1) // Low bound is less than input range.
> - return ReplaceInstUsesWith(ICI, Builder->getFalse());
> + return ReplaceInstUsesWith(ICI, ConstantInt::getFalse(ICI.getContext()));
> 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, Builder->getFalse());
> + return ReplaceInstUsesWith(ICI, ConstantInt::getFalse(ICI.getContext()));
> if (HiOverflow == -1) // High bound less than input range.
> - return ReplaceInstUsesWith(ICI, Builder->getTrue());
> + return ReplaceInstUsesWith(ICI, ConstantInt::getTrue(ICI.getContext()));
> if (Pred == ICmpInst::ICMP_UGT)
> return new ICmpInst(ICmpInst::ICMP_UGE, X, HiBound);
> return new ICmpInst(ICmpInst::ICMP_SGE, X, HiBound);
> @@ -1015,7 +1017,7 @@ Instruction *InstCombiner::FoldICmpShrCs
> // If we are comparing against bits always shifted out, the
> // comparison cannot succeed.
> APInt Comp = CmpRHSV << ShAmtVal;
> - ConstantInt *ShiftedCmpRHS = Builder->getInt(Comp);
> + ConstantInt *ShiftedCmpRHS = ConstantInt::get(ICI.getContext(), Comp);
> if (Shr->getOpcode() == Instruction::LShr)
> Comp = Comp.lshr(ShAmtVal);
> else
> @@ -1023,7 +1025,8 @@ 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 = Builder->getInt1(IsICMP_NE);
> + Constant *Cst = ConstantInt::get(Type::getInt1Ty(ICI.getContext()),
> + IsICMP_NE);
> return ReplaceInstUsesWith(ICI, Cst);
> }
>
> @@ -1036,7 +1039,7 @@ Instruction *InstCombiner::FoldICmpShrCs
> if (Shr->hasOneUse()) {
> // Otherwise strength reduce the shift into an and.
> APInt Val(APInt::getHighBitsSet(TypeBits, TypeBits - ShAmtVal));
> - Constant *Mask = Builder->getInt(Val);
> + Constant *Mask = ConstantInt::get(ICI.getContext(), Val);
>
> Value *And = Builder->CreateAnd(Shr->getOperand(0),
> Mask, Shr->getName()+".mask");
> @@ -1069,7 +1072,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),
> - Builder->getInt(NewRHS));
> + ConstantInt::get(ICI.getContext(), NewRHS));
> }
> }
> break;
> @@ -1112,7 +1115,8 @@ Instruction *InstCombiner::visitICmpInst
> ? ICI.getUnsignedPredicate()
> : ICI.getSignedPredicate();
> return new ICmpInst(Pred, LHSI->getOperand(0),
> - Builder->getInt(RHSV ^ SignBit));
> + ConstantInt::get(ICI.getContext(),
> + RHSV ^ SignBit));
> }
>
> // (icmp u/s (xor A ~SignBit), C) -> (icmp s/u (xor C ~SignBit), A)
> @@ -1123,7 +1127,8 @@ Instruction *InstCombiner::visitICmpInst
> : ICI.getSignedPredicate();
> Pred = ICI.getSwappedPredicate(Pred);
> return new ICmpInst(Pred, LHSI->getOperand(0),
> - Builder->getInt(RHSV ^ NotSignBit));
> + ConstantInt::get(ICI.getContext(),
> + RHSV ^ NotSignBit));
> }
> }
> }
> @@ -1213,9 +1218,11 @@ 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, Builder->getFalse());
> + return ReplaceInstUsesWith(ICI,
> + ConstantInt::getFalse(ICI.getContext()));
> if (ICI.getPredicate() == ICmpInst::ICMP_NE)
> - return ReplaceInstUsesWith(ICI, Builder->getTrue());
> + return ReplaceInstUsesWith(ICI,
> + ConstantInt::getTrue(ICI.getContext()));
> } else {
> ICI.setOperand(1, NewCst);
> Constant *NewAndCST;
> @@ -1337,7 +1344,8 @@ 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 = Builder->getInt1(IsICMP_NE);
> + Constant *Cst =
> + ConstantInt::get(Type::getInt1Ty(ICI.getContext()), IsICMP_NE);
> return ReplaceInstUsesWith(ICI, Cst);
> }
>
> @@ -1356,8 +1364,9 @@ Instruction *InstCombiner::visitICmpInst
> if (LHSI->hasOneUse()) {
> // Otherwise strength reduce the shift into an and.
> uint32_t ShAmtVal = (uint32_t)ShAmt->getLimitedValue(TypeBits);
> - Constant *Mask = Builder->getInt(APInt::getLowBitsSet(TypeBits,
> - TypeBits - ShAmtVal));
> + Constant *Mask =
> + ConstantInt::get(ICI.getContext(), APInt::getLowBitsSet(TypeBits,
> + TypeBits-ShAmtVal));
>
> Value *And =
> Builder->CreateAnd(LHSI->getOperand(0),Mask, LHSI->getName()+".mask");
> @@ -1455,18 +1464,18 @@ Instruction *InstCombiner::visitICmpInst
> if (ICI.isSigned()) {
> if (CR.getLower().isSignBit()) {
> return new ICmpInst(ICmpInst::ICMP_SLT, LHSI->getOperand(0),
> - Builder->getInt(CR.getUpper()));
> + ConstantInt::get(ICI.getContext(),CR.getUpper()));
> } else if (CR.getUpper().isSignBit()) {
> return new ICmpInst(ICmpInst::ICMP_SGE, LHSI->getOperand(0),
> - Builder->getInt(CR.getLower()));
> + ConstantInt::get(ICI.getContext(),CR.getLower()));
> }
> } else {
> if (CR.getLower().isMinValue()) {
> return new ICmpInst(ICmpInst::ICMP_ULT, LHSI->getOperand(0),
> - Builder->getInt(CR.getUpper()));
> + ConstantInt::get(ICI.getContext(),CR.getUpper()));
> } else if (CR.getUpper().isMinValue()) {
> return new ICmpInst(ICmpInst::ICMP_UGE, LHSI->getOperand(0),
> - Builder->getInt(CR.getLower()));
> + ConstantInt::get(ICI.getContext(),CR.getLower()));
> }
> }
> }
> @@ -1546,7 +1555,9 @@ 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, Builder->getInt1(isICMP_NE));
> + return ReplaceInstUsesWith(ICI,
> + ConstantInt::get(Type::getInt1Ty(ICI.getContext()),
> + isICMP_NE));
> }
> break;
>
> @@ -1555,7 +1566,9 @@ 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, Builder->getInt1(isICMP_NE));
> + return ReplaceInstUsesWith(ICI,
> + ConstantInt::get(Type::getInt1Ty(ICI.getContext()),
> + isICMP_NE));
>
> // If we have ((X & C) == C), turn it into ((X & C) != 0).
> if (RHS == BOC && RHSV.isPowerOf2())
> @@ -1606,7 +1619,7 @@ Instruction *InstCombiner::visitICmpInst
> case Intrinsic::bswap:
> Worklist.Add(II);
> ICI.setOperand(0, II->getArgOperand(0));
> - ICI.setOperand(1, Builder->getInt(RHSV.byteSwap()));
> + ICI.setOperand(1, ConstantInt::get(II->getContext(), RHSV.byteSwap()));
> return &ICI;
> case Intrinsic::ctlz:
> case Intrinsic::cttz:
> @@ -2028,19 +2041,19 @@ Instruction *InstCombiner::visitICmpInst
> case ICmpInst::ICMP_ULE:
> assert(!CI->isMaxValue(false)); // A <=u MAX -> TRUE
> return new ICmpInst(ICmpInst::ICMP_ULT, Op0,
> - Builder->getInt(CI->getValue()+1));
> + ConstantInt::get(CI->getContext(), CI->getValue()+1));
> case ICmpInst::ICMP_SLE:
> assert(!CI->isMaxValue(true)); // A <=s MAX -> TRUE
> return new ICmpInst(ICmpInst::ICMP_SLT, Op0,
> - Builder->getInt(CI->getValue()+1));
> + ConstantInt::get(CI->getContext(), CI->getValue()+1));
> case ICmpInst::ICMP_UGE:
> assert(!CI->isMinValue(false)); // A >=u MIN -> TRUE
> return new ICmpInst(ICmpInst::ICMP_UGT, Op0,
> - Builder->getInt(CI->getValue()-1));
> + ConstantInt::get(CI->getContext(), CI->getValue()-1));
> case ICmpInst::ICMP_SGE:
> assert(!CI->isMinValue(true)); // A >=s MIN -> TRUE
> return new ICmpInst(ICmpInst::ICMP_SGT, Op0,
> - Builder->getInt(CI->getValue()-1));
> + ConstantInt::get(CI->getContext(), CI->getValue()-1));
> }
>
> // If this comparison is a normal comparison, it demands all
> @@ -2179,7 +2192,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,
> - Builder->getInt(CI->getValue()-1));
> + ConstantInt::get(CI->getContext(), CI->getValue()-1));
>
> // (x <u 2147483648) -> (x >s -1) -> true if sign bit clear
> if (CI->isMinValue(true))
> @@ -2198,7 +2211,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,
> - Builder->getInt(CI->getValue()+1));
> + ConstantInt::get(CI->getContext(), CI->getValue()+1));
>
> // (x >u 2147483647) -> (x <s 0) -> true if sign bit set
> if (CI->isMaxValue(true))
> @@ -2216,7 +2229,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,
> - Builder->getInt(CI->getValue()-1));
> + ConstantInt::get(CI->getContext(), CI->getValue()-1));
> }
> break;
> case ICmpInst::ICMP_SGT:
> @@ -2230,7 +2243,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,
> - Builder->getInt(CI->getValue()+1));
> + ConstantInt::get(CI->getContext(), CI->getValue()+1));
> }
> break;
> case ICmpInst::ICMP_SGE:
> @@ -2706,7 +2719,8 @@ Instruction *InstCombiner::visitICmpInst
> ConstantInt *C1, *C2;
> if (match(B, m_ConstantInt(C1)) &&
> match(D, m_ConstantInt(C2)) && Op1->hasOneUse()) {
> - Constant *NC = Builder->getInt(C1->getValue() ^ C2->getValue());
> + Constant *NC = ConstantInt::get(I.getContext(),
> + C1->getValue() ^ C2->getValue());
> Value *Xor = Builder->CreateXor(C, NC);
> return new ICmpInst(I.getPredicate(), A, Xor);
> }
> @@ -2871,9 +2885,9 @@ Instruction *InstCombiner::FoldFCmp_IntT
> Pred = ICmpInst::ICMP_NE;
> break;
> case FCmpInst::FCMP_ORD:
> - return ReplaceInstUsesWith(I, Builder->getTrue());
> + return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
> case FCmpInst::FCMP_UNO:
> - return ReplaceInstUsesWith(I, Builder->getTrue());
> + return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
> }
>
> IntegerType *IntTy = cast<IntegerType>(LHSI->getOperand(0)->getType());
> @@ -2893,8 +2907,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, Builder->getTrue());
> - return ReplaceInstUsesWith(I, Builder->getFalse());
> + return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
> + return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
> }
> } else {
> // If the RHS value is > UnsignedMax, fold the comparison. This handles
> @@ -2905,8 +2919,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, Builder->getTrue());
> - return ReplaceInstUsesWith(I, Builder->getFalse());
> + return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
> + return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
> }
> }
>
> @@ -2918,8 +2932,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, Builder->getTrue());
> - return ReplaceInstUsesWith(I, Builder->getFalse());
> + return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
> + return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
> }
> } else {
> // See if the RHS value is < UnsignedMin.
> @@ -2929,8 +2943,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, Builder->getTrue());
> - return ReplaceInstUsesWith(I, Builder->getFalse());
> + return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
> + return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
> }
> }
>
> @@ -2952,14 +2966,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, Builder->getTrue());
> + return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
> case ICmpInst::ICMP_EQ: // (float)int == 4.4 --> false
> - return ReplaceInstUsesWith(I, Builder->getFalse());
> + return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
> case ICmpInst::ICMP_ULE:
> // (float)int <= 4.4 --> int <= 4
> // (float)int <= -4.4 --> false
> if (RHS.isNegative())
> - return ReplaceInstUsesWith(I, Builder->getFalse());
> + return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
> break;
> case ICmpInst::ICMP_SLE:
> // (float)int <= 4.4 --> int <= 4
> @@ -2971,7 +2985,7 @@ Instruction *InstCombiner::FoldFCmp_IntT
> // (float)int < -4.4 --> false
> // (float)int < 4.4 --> int <= 4
> if (RHS.isNegative())
> - return ReplaceInstUsesWith(I, Builder->getFalse());
> + return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
> Pred = ICmpInst::ICMP_ULE;
> break;
> case ICmpInst::ICMP_SLT:
> @@ -2984,7 +2998,7 @@ Instruction *InstCombiner::FoldFCmp_IntT
> // (float)int > 4.4 --> int > 4
> // (float)int > -4.4 --> true
> if (RHS.isNegative())
> - return ReplaceInstUsesWith(I, Builder->getTrue());
> + return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
> break;
> case ICmpInst::ICMP_SGT:
> // (float)int > 4.4 --> int > 4
> @@ -2996,7 +3010,7 @@ Instruction *InstCombiner::FoldFCmp_IntT
> // (float)int >= -4.4 --> true
> // (float)int >= 4.4 --> int > 4
> if (RHS.isNegative())
> - return ReplaceInstUsesWith(I, Builder->getTrue());
> + return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
> 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