Lines Matching refs:ConstantInt
110 ConstantInt *AndCst) { in foldCmpLoadFromIndexedGlobal()
125 !isa<ConstantInt>(GEP->getOperand(1)) || in foldCmpLoadFromIndexedGlobal()
126 !cast<ConstantInt>(GEP->getOperand(1))->isZero() || in foldCmpLoadFromIndexedGlobal()
137 ConstantInt *Idx = dyn_cast<ConstantInt>(GEP->getOperand(i)); in foldCmpLoadFromIndexedGlobal()
212 if (!isa<ConstantInt>(C)) return nullptr; in foldCmpLoadFromIndexedGlobal()
216 bool IsTrueForElt = !cast<ConstantInt>(C)->isZero(); in foldCmpLoadFromIndexedGlobal()
293 Value *Mask = ConstantInt::get(Idx->getType(), -1); in foldCmpLoadFromIndexedGlobal()
308 Value *FirstTrueIdx = ConstantInt::get(Idx->getType(), FirstTrueElement); in foldCmpLoadFromIndexedGlobal()
316 Value *SecondTrueIdx = ConstantInt::get(Idx->getType(), SecondTrueElement); in foldCmpLoadFromIndexedGlobal()
329 Value *FirstFalseIdx = ConstantInt::get(Idx->getType(), FirstFalseElement); in foldCmpLoadFromIndexedGlobal()
337 Value *SecondFalseIdx = ConstantInt::get(Idx->getType(),SecondFalseElement); in foldCmpLoadFromIndexedGlobal()
350 Value *Offs = ConstantInt::get(Idx->getType(), -FirstTrueElement); in foldCmpLoadFromIndexedGlobal()
354 Value *End = ConstantInt::get(Idx->getType(), in foldCmpLoadFromIndexedGlobal()
365 Value *Offs = ConstantInt::get(Idx->getType(), -FirstFalseElement); in foldCmpLoadFromIndexedGlobal()
369 Value *End = ConstantInt::get(Idx->getType(), in foldCmpLoadFromIndexedGlobal()
391 V = Builder.CreateLShr(ConstantInt::get(Ty, MagicBitvector), V); in foldCmpLoadFromIndexedGlobal()
392 V = Builder.CreateAnd(ConstantInt::get(Ty, 1), V); in foldCmpLoadFromIndexedGlobal()
393 return new ICmpInst(ICmpInst::ICMP_NE, V, ConstantInt::get(Ty, 0)); in foldCmpLoadFromIndexedGlobal()
422 if (ConstantInt *CI = dyn_cast<ConstantInt>(GEP->getOperand(i))) { in evaluateGEPOffsetExpression()
450 ConstantInt *CI = dyn_cast<ConstantInt>(GEP->getOperand(i)); in evaluateGEPOffsetExpression()
498 Constant *OffsetVal = ConstantInt::get(IntPtrTy, NewOffs); in evaluateGEPOffsetExpression()
643 NewInsts[Base] = ConstantInt::getNullValue(IndexType); in rewriteGEPAsOffset()
684 if (isa<ConstantInt>(Op) && cast<ConstantInt>(Op)->isZero()) in rewriteGEPAsOffset()
753 Constant *Index = ConstantInt::getNullValue(IndexType); in getAsConstantIndexedAddress()
984 ConstantInt::get(I.getType(), ICmpInst::isTrueWhenEqual(Cond))); in foldGEPICmp()
1084 ConstantInt::get(CmpTy, !CmpInst::isTrueWhenEqual(ICI.getPredicate()))); in foldAllocaCmp()
1099 Constant *R = ConstantInt::get(X->getType(), in foldICmpAddOpConst()
1109 ConstantInt::get(X->getType(), -C)); in foldICmpAddOpConst()
1121 ConstantInt::get(X->getType(), SMax - C)); in foldICmpAddOpConst()
1132 ConstantInt::get(X->getType(), SMax - (C - 1))); in foldICmpAddOpConst()
1166 ConstantInt::get(A->getType(), AP2.logBase2())); in foldICmpShrConstConst()
1169 return getICmp(I.ICMP_EQ, A, ConstantInt::getNullValue(A->getType())); in foldICmpShrConstConst()
1182 return getICmp(I.ICMP_UGE, A, ConstantInt::get(A->getType(), Shift)); in foldICmpShrConstConst()
1183 return getICmp(I.ICMP_EQ, A, ConstantInt::get(A->getType(), Shift)); in foldICmpShrConstConst()
1185 return getICmp(I.ICMP_EQ, A, ConstantInt::get(A->getType(), Shift)); in foldICmpShrConstConst()
1191 auto *TorF = ConstantInt::get(I.getType(), I.getPredicate() == I.ICMP_NE); in foldICmpShrConstConst()
1217 ConstantInt::get(A->getType(), AP2.getBitWidth() - AP2TrailingZeros)); in foldICmpShlConstConst()
1220 return getICmp(I.ICMP_EQ, A, ConstantInt::getNullValue(A->getType())); in foldICmpShlConstConst()
1226 return getICmp(I.ICMP_EQ, A, ConstantInt::get(A->getType(), Shift)); in foldICmpShlConstConst()
1230 auto *TorF = ConstantInt::get(I.getType(), I.getPredicate() == I.ICMP_NE); in foldICmpShlConstConst()
1242 ConstantInt *CI2, ConstantInt *CI1, in processUGT_ADDCST_ADD()
1375 X, ConstantInt::getNullValue(XTy)); in foldSignBitTest()
1435 ConstantInt *CI, *CI2; // I = icmp ugt (add (add A, B), CI2), CI in foldICmpWithConstant()
1489 return replaceInstUsesWith(Cmp, ConstantInt::get(Cmp.getType(), *Imp)); in foldICmpWithDominatingICmp()
1552 ConstantInt::get(V->getType(), 1)); in foldICmpTruncConstant()
1567 return new ICmpInst(Pred, X, ConstantInt::get(X->getType(), NewRHS)); in foldICmpTruncConstant()
1582 ConstantInt::getNullValue(X->getType())) in foldICmpTruncConstant()
1584 ConstantInt::getAllOnesValue(X->getType())); in foldICmpTruncConstant()
1614 ConstantInt::getAllOnesValue(X->getType())); in foldICmpXorConstant()
1617 ConstantInt::getNullValue(X->getType())); in foldICmpXorConstant()
1624 return new ICmpInst(Pred, X, ConstantInt::get(X->getType(), C ^ *XorC)); in foldICmpXorConstant()
1631 return new ICmpInst(Pred, X, ConstantInt::get(X->getType(), C ^ *XorC)); in foldICmpXorConstant()
1648 ConstantInt::get(X->getType(), ~C)); in foldICmpXorConstant()
1652 ConstantInt::get(X->getType(), ~C)); in foldICmpXorConstant()
1714 return replaceInstUsesWith(Cmp, ConstantInt::getFalse(Cmp.getType())); in foldICmpAndShift()
1716 return replaceInstUsesWith(Cmp, ConstantInt::getTrue(Cmp.getType())); in foldICmpAndShift()
1719 Shift->getOperand(0), ConstantInt::get(And->getType(), NewAndCst)); in foldICmpAndShift()
1721 NewAnd, ConstantInt::get(And->getType(), NewCmpCst)); in foldICmpAndShift()
1801 Constant *ZextC1 = ConstantInt::get(WideType, C1.zext(WideScalarBits)); in foldICmpAndConstConst()
1802 Constant *ZextC2 = ConstantInt::get(WideType, C2->zext(WideScalarBits)); in foldICmpAndConstConst()
1867 return new ICmpInst(NewPred, X, ConstantInt::getNullValue(X->getType())); in foldICmpAndConstant()
1880 !LI->isVolatile() && isa<ConstantInt>(Y)) { in foldICmpAndConstant()
1881 ConstantInt *C2 = cast<ConstantInt>(Y); in foldICmpAndConstant()
1928 ConstantInt::get(V->getType(), 1)); in foldICmpOrConstant()
1948 Constant *NewC = ConstantInt::get(Or->getType(), C ^ (*MaskC)); in foldICmpOrConstant()
1961 Builder.CreateICmp(Pred, P, ConstantInt::getNullValue(P->getType())); in foldICmpOrConstant()
1963 Builder.CreateICmp(Pred, Q, ConstantInt::getNullValue(Q->getType())); in foldICmpOrConstant()
2007 Constant *NewC = ConstantInt::get(Mul->getType(), C.sdiv(*MulC)); in foldICmpMulConstant()
2012 Constant *NewC = ConstantInt::get(Mul->getType(), C.udiv(*MulC)); in foldICmpMulConstant()
2053 return new ICmpInst(Pred, Y, ConstantInt::get(ShiftType, CLog2)); in foldICmpShlOne()
2055 Constant *BitWidthMinusOne = ConstantInt::get(ShiftType, TypeBits - 1); in foldICmpShlOne()
2076 return new ICmpInst(Pred, Y, ConstantInt::get(ShiftType, C.logBase2())); in foldICmpShlOne()
2111 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC)); in foldICmpShlConstant()
2116 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC)); in foldICmpShlConstant()
2125 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC)); in foldICmpShlConstant()
2141 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC)); in foldICmpShlConstant()
2146 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC)); in foldICmpShlConstant()
2155 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC)); in foldICmpShlConstant()
2161 Constant *Mask = ConstantInt::get( in foldICmpShlConstant()
2165 Constant *LShrC = ConstantInt::get(ShType, C.lshr(*ShiftAmt)); in foldICmpShlConstant()
2173 Constant *Mask = ConstantInt::get( in foldICmpShlConstant()
2215 ConstantInt::get(TruncTy, C.ashr(*ShiftAmt).trunc(TypeBits - Amt)); in foldICmpShlConstant()
2262 return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, ShiftedC)); in foldICmpShrConstant()
2269 return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, ShiftedC)); in foldICmpShrConstant()
2279 ConstantInt::getNullValue(ShrTy)); in foldICmpShrConstant()
2283 ConstantInt::getAllOnesValue(ShrTy)); in foldICmpShrConstant()
2292 return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, ShiftedC)); in foldICmpShrConstant()
2298 return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, ShiftedC)); in foldICmpShrConstant()
2317 return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, C << ShAmtVal)); in foldICmpShrConstant()
2323 ConstantInt::get(ShrTy, (C + 1).shl(ShAmtVal))); in foldICmpShrConstant()
2326 ConstantInt::get(ShrTy, (C + 1).shl(ShAmtVal) - 1)); in foldICmpShrConstant()
2333 Constant *Mask = ConstantInt::get(ShrTy, Val); in foldICmpShrConstant()
2335 return new ICmpInst(Pred, And, ConstantInt::get(ShrTy, C << ShAmtVal)); in foldICmpShrConstant()
2364 Constant *MaskC = ConstantInt::get(Ty, SignMask | (*DivisorC - 1)); in foldICmpSRemConstant()
2371 return new ICmpInst(ICmpInst::ICMP_SGT, And, ConstantInt::getNullValue(Ty)); in foldICmpSRemConstant()
2376 return new ICmpInst(ICmpInst::ICMP_UGT, And, ConstantInt::get(Ty, SignMask)); in foldICmpSRemConstant()
2395 ConstantInt::get(Y->getType(), C2->udiv(C + 1))); in foldICmpUDivConstant()
2402 ConstantInt::get(Y->getType(), C2->udiv(C))); in foldICmpUDivConstant()
2534 ConstantInt::get(Div->getType(), LoBound)); in foldICmpDivConstant()
2538 ConstantInt::get(Div->getType(), HiBound)); in foldICmpDivConstant()
2547 ConstantInt::get(Div->getType(), LoBound)); in foldICmpDivConstant()
2551 ConstantInt::get(Div->getType(), HiBound)); in foldICmpDivConstant()
2561 return new ICmpInst(Pred, X, ConstantInt::get(Div->getType(), LoBound)); in foldICmpDivConstant()
2570 ConstantInt::get(Div->getType(), HiBound)); in foldICmpDivConstant()
2572 ConstantInt::get(Div->getType(), HiBound)); in foldICmpDivConstant()
2590 ConstantInt::get(Y->getType(), 0)); in foldICmpSubConstant()
2598 ConstantInt::get(Y->getType(), SubResult)); in foldICmpSubConstant()
2669 return new ICmpInst(Pred, X, ConstantInt::get(Ty, NewC)); in foldICmpAddConstant()
2677 return new ICmpInst(ICmpInst::ICMP_SLT, X, ConstantInt::get(Ty, Upper)); in foldICmpAddConstant()
2679 return new ICmpInst(ICmpInst::ICMP_SGE, X, ConstantInt::get(Ty, Lower)); in foldICmpAddConstant()
2682 return new ICmpInst(ICmpInst::ICMP_ULT, X, ConstantInt::get(Ty, Upper)); in foldICmpAddConstant()
2684 return new ICmpInst(ICmpInst::ICMP_UGE, X, ConstantInt::get(Ty, Lower)); in foldICmpAddConstant()
2695 return new ICmpInst(ICmpInst::ICMP_SLT, X, ConstantInt::get(Ty, -(*C2))); in foldICmpAddConstant()
2699 return new ICmpInst(ICmpInst::ICMP_SGT, X, ConstantInt::get(Ty, ~(*C2))); in foldICmpAddConstant()
2703 return new ICmpInst(ICmpInst::ICMP_ULT, X, ConstantInt::get(Ty, SMax - C)); in foldICmpAddConstant()
2707 return new ICmpInst(ICmpInst::ICMP_UGT, X, ConstantInt::get(Ty, C ^ SMax)); in foldICmpAddConstant()
2730 Value *&RHS, ConstantInt *&Less, in matchThreeWayIntCompare()
2731 ConstantInt *&Equal, in matchThreeWayIntCompare()
2732 ConstantInt *&Greater) { in matchThreeWayIntCompare()
2784 ConstantInt *C) { in foldICmpSelectConstant()
2793 ConstantInt *C1LessThan, *C2Equal, *C3GreaterThan; in foldICmpSelectConstant()
2856 return new ICmpInst(Pred, X, ConstantInt::getNullValue(X->getType())); in foldICmpBitCast()
2860 return new ICmpInst(Pred, X, ConstantInt::get(X->getType(), 1)); in foldICmpBitCast()
2865 ConstantInt::getAllOnesValue(X->getType())); in foldICmpBitCast()
2873 return new ICmpInst(Pred, X, ConstantInt::getNullValue(X->getType())); in foldICmpBitCast()
2898 ConstantInt::getNullValue(NewType)); in foldICmpBitCast()
2901 ConstantInt::getAllOnesValue(NewType)); in foldICmpBitCast()
2948 Value *NewC = ConstantInt::get(EltTy, C->trunc(EltTy->getBitWidth())); in foldICmpBitCast()
3024 if (ConstantInt *ConstRHS = dyn_cast<ConstantInt>(Cmp.getOperand(1))) in foldICmpInstWithConstant()
3158 ConstantInt::get(Ty, C)); in foldICmpEqIntrinsicWithConstant()
3164 ConstantInt::get(Ty, C.byteSwap())); in foldICmpEqIntrinsicWithConstant()
3171 ConstantInt::getNullValue(Ty)); in foldICmpEqIntrinsicWithConstant()
3186 ConstantInt::get(Ty, Mask2)); in foldICmpEqIntrinsicWithConstant()
3243 ConstantInt::getAllOnesValue(Ty)); in foldICmpIntrinsicWithConstant()
3247 ConstantInt::getAllOnesValue(Ty)); in foldICmpIntrinsicWithConstant()
3256 II->getArgOperand(0), ConstantInt::get(Ty, Limit)); in foldICmpIntrinsicWithConstant()
3264 II->getArgOperand(0), ConstantInt::get(Ty, Limit)); in foldICmpIntrinsicWithConstant()
3278 ConstantInt::getNullValue(Ty)); in foldICmpIntrinsicWithConstant()
3286 ConstantInt::getNullValue(Ty)); in foldICmpIntrinsicWithConstant()
3327 ConstantInt *CI = nullptr; in foldICmpInstWithConstantNotInt()
3341 CI = dyn_cast<ConstantInt>(Op1); in foldICmpInstWithConstantNotInt()
3345 CI = dyn_cast<ConstantInt>(Op2); in foldICmpInstWithConstantNotInt()
3571 Value *T0 = Builder.CreateAdd(X, ConstantInt::get(XType, AddCst)); in foldICmpWithTruncSignExtendedVal()
3573 Value *T1 = Builder.CreateICmp(DstPred, T0, ConstantInt::get(XType, ICmpCst)); in foldICmpWithTruncSignExtendedVal()
3995 if (ConstantInt *C1 = dyn_cast<ConstantInt>(B)) in foldICmpBinOp()
3996 if (ConstantInt *C2 = dyn_cast<ConstantInt>(D)) { in foldICmpBinOp()
4003 ConstantInt *C3 = Builder.getInt(AP1 - AP2); in foldICmpBinOp()
4009 ConstantInt *C3 = Builder.getInt(AP2 - AP1); in foldICmpBinOp()
4102 return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType())); in foldICmpBinOp()
4104 return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType())); in foldICmpBinOp()
4154 Constant *Mask = ConstantInt::get( in foldICmpBinOp()
4320 ConstantInt *C1, *C2; in foldICmpEquality()
4378 ConstantInt *Cst1; in foldICmpEquality()
4473 ? new ICmpInst(ICmpInst::ICMP_ULT, CtPop, ConstantInt::get(Ty, 2)) in foldICmpEquality()
4474 : new ICmpInst(ICmpInst::ICMP_UGT, CtPop, ConstantInt::get(Ty, 1)); in foldICmpEquality()
4558 if (IsSignedCmp || !IsSignedExt || !isa<ConstantInt>(C)) in foldICmpWithZextOrSext()
4683 Overflow = ConstantInt::getFalse(OverflowTy); in OptimizeOverflowCheck()
4694 Overflow = ConstantInt::getTrue(OverflowTy); in OptimizeOverflowCheck()
4699 Overflow = ConstantInt::getFalse(OverflowTy); in OptimizeOverflowCheck()
4777 if (ConstantInt *CI = dyn_cast<ConstantInt>(BO->getOperand(1))) { in processUMulZExtIdiom()
4800 ConstantInt *CI; in processUMulZExtIdiom()
4818 if (ConstantInt *CI = dyn_cast<ConstantInt>(OtherVal)) { in processUMulZExtIdiom()
4830 if (ConstantInt *CI = dyn_cast<ConstantInt>(OtherVal)) { in processUMulZExtIdiom()
4841 if (ConstantInt *CI = dyn_cast<ConstantInt>(OtherVal)) { in processUMulZExtIdiom()
4853 if (ConstantInt *CI = dyn_cast<ConstantInt>(OtherVal)) { in processUMulZExtIdiom()
4894 ConstantInt *CI = cast<ConstantInt>(BO->getOperand(1)); in processUMulZExtIdiom()
5187 ConstantInt::get(Op1->getType(), *CmpC - 1)); in foldICmpUsingKnownBits()
5204 ConstantInt::get(Op1->getType(), *CmpC + 1)); in foldICmpUsingKnownBits()
5220 ConstantInt::get(Op1->getType(), *CmpC - 1)); in foldICmpUsingKnownBits()
5231 ConstantInt::get(Op1->getType(), *CmpC + 1)); in foldICmpUsingKnownBits()
5247 I, ConstantInt::getBool(I.getType(), Pred == CmpInst::ICMP_NE)); in foldICmpUsingKnownBits()
5268 auto *CmpC = ConstantInt::get(XTy, ValToCheck.countTrailingZeros()); in foldICmpUsingKnownBits()
5274 auto *CmpC = ConstantInt::get(XTy, ValToCheck.countTrailingZeros()); in foldICmpUsingKnownBits()
5289 return new ICmpInst(NewPred, X, ConstantInt::get(X->getType(), CmpVal)); in foldICmpUsingKnownBits()
5296 return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType())); in foldICmpUsingKnownBits()
5298 return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType())); in foldICmpUsingKnownBits()
5303 return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType())); in foldICmpUsingKnownBits()
5305 return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType())); in foldICmpUsingKnownBits()
5310 return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType())); in foldICmpUsingKnownBits()
5312 return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType())); in foldICmpUsingKnownBits()
5317 return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType())); in foldICmpUsingKnownBits()
5319 return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType())); in foldICmpUsingKnownBits()
5323 assert(!isa<ConstantInt>(Op1) && "ICMP_SGE with ConstantInt not folded!"); in foldICmpUsingKnownBits()
5325 return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType())); in foldICmpUsingKnownBits()
5327 return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType())); in foldICmpUsingKnownBits()
5332 assert(!isa<ConstantInt>(Op1) && "ICMP_SLE with ConstantInt not folded!"); in foldICmpUsingKnownBits()
5334 return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType())); in foldICmpUsingKnownBits()
5336 return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType())); in foldICmpUsingKnownBits()
5341 assert(!isa<ConstantInt>(Op1) && "ICMP_UGE with ConstantInt not folded!"); in foldICmpUsingKnownBits()
5343 return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType())); in foldICmpUsingKnownBits()
5345 return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType())); in foldICmpUsingKnownBits()
5350 assert(!isa<ConstantInt>(Op1) && "ICMP_ULE with ConstantInt not folded!"); in foldICmpUsingKnownBits()
5352 return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType())); in foldICmpUsingKnownBits()
5354 return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType())); in foldICmpUsingKnownBits()
5385 auto ConstantIsOk = [WillIncrement, IsSigned](ConstantInt *C) { in getFlippedStrictnessPredicateAndConstant()
5390 if (auto *CI = dyn_cast<ConstantInt>(C)) { in getFlippedStrictnessPredicateAndConstant()
5406 auto *CI = dyn_cast<ConstantInt>(Elt); in getFlippedStrictnessPredicateAndConstant()
5430 Constant *OneOrNegOne = ConstantInt::get(Type, WillIncrement ? 1 : -1, true); in getFlippedStrictnessPredicateAndConstant()
5841 ConstantInt::get(Op1->getType(), ~(*C))); in visitICmpInst()
6431 ConstantInt::getNullValue(IntType)); in visitFCmpInst()