27#define DEBUG_TYPE "instcombine"
33 const APInt &Demanded) {
35 assert(OpNo < I->getNumOperands() &&
"Operand index too large");
44 if (
C->isSubsetOf(Demanded))
48 I->setOperand(OpNo, ConstantInt::get(
Op->getType(), *
C & Demanded));
60 const APInt &DemandedMask,
63 assert(
I->getOpcode() == Instruction::LShr &&
64 "Only lshr instruction supported");
68 if (!
match(
I->getOperand(0),
78 if (DemandedBitWidth > ShlAmt)
82 if (
Upper->getType()->getScalarSizeInBits() < ShlAmt + DemandedBitWidth)
89 Value *ShrAmt =
I->getOperand(1);
94 if (~KnownShrBits.
Zero != ShlAmt)
113 if (
unsigned BitWidth = Ty->getScalarSizeInBits())
116 return DL.getPointerTypeSizeInBits(Ty);
125 SQ.getWithInstruction(&Inst));
126 if (!V)
return false;
127 if (V == &Inst)
return true;
143 SQ.getWithInstruction(&Inst));
156 const APInt &DemandedMask,
160 Use &U =
I->getOperandUse(OpNo);
168 if (DemandedMask.
isZero()) {
193 if (!NewVal)
return false;
225 const APInt &DemandedMask,
229 assert(
I !=
nullptr &&
"Null pointer of Value???");
232 Type *VTy =
I->getType();
236 "Value *V, DemandedMask and Known must have same BitWidth");
242 auto disableWrapFlagsBasedOnUnusedHighBits = [](
Instruction *
I,
248 I->setHasNoSignedWrap(
false);
249 I->setHasNoUnsignedWrap(
false);
256 auto simplifyOperandsBasedOnUnusedHighBits = [&](
APInt &DemandedFromOps) {
265 disableWrapFlagsBasedOnUnusedHighBits(
I, NLZ);
271 switch (
I->getOpcode()) {
275 case Instruction::And: {
293 return I->getOperand(0);
295 return I->getOperand(1);
303 case Instruction::Or: {
309 I->dropPoisonGeneratingFlags();
324 return I->getOperand(0);
326 return I->getOperand(1);
335 RHSCache(
I->getOperand(1), RHSKnown);
344 case Instruction::Xor: {
355 return Builder.CreateUnaryIntrinsic(Intrinsic::ctpop,
Xor);
369 return I->getOperand(0);
371 return I->getOperand(1);
378 BinaryOperator::CreateOr(
I->getOperand(0),
I->getOperand(1));
392 ~RHSKnown.
One & DemandedMask);
402 if ((*
C | ~DemandedMask).isAllOnes()) {
418 if (LHSInst->getOpcode() == Instruction::And && LHSInst->hasOneUse() &&
421 (LHSKnown.One & RHSKnown.
One & DemandedMask) != 0) {
422 APInt NewMask = ~(LHSKnown.One & RHSKnown.
One & DemandedMask);
425 Instruction *NewAnd = BinaryOperator::CreateAnd(
I->getOperand(0), AndC);
429 Instruction *NewXor = BinaryOperator::CreateXor(NewAnd, XorC);
435 case Instruction::Select: {
445 auto CanonicalizeSelectConstant = [](
Instruction *
I,
unsigned OpNo,
446 const APInt &DemandedMask) {
466 if ((*CmpC & DemandedMask) == (*SelC & DemandedMask)) {
467 I->setOperand(OpNo, ConstantInt::get(
I->getType(), *CmpC));
472 if (CanonicalizeSelectConstant(
I, 1, DemandedMask) ||
473 CanonicalizeSelectConstant(
I, 2, DemandedMask))
481 Known = LHSKnown.intersectWith(RHSKnown);
484 case Instruction::Trunc: {
503 case Instruction::ZExt: {
504 unsigned SrcBitWidth =
I->getOperand(0)->getType()->getScalarSizeInBits();
512 I->dropPoisonGeneratingFlags();
516 if (
I->getOpcode() == Instruction::ZExt &&
I->hasNonNeg() &&
523 case Instruction::SExt: {
525 unsigned SrcBitWidth =
I->getOperand(0)->getType()->getScalarSizeInBits();
527 APInt InputDemandedBits = DemandedMask.
trunc(SrcBitWidth);
532 InputDemandedBits.
setBit(SrcBitWidth-1);
553 case Instruction::Add: {
554 if ((DemandedMask & 1) == 0) {
560 X->getType()->isIntOrIntVectorTy(1) &&
X->getType() ==
Y->getType()) {
570 return Builder.CreateSExt(AndNot, VTy);
575 X->getType()->isIntOrIntVectorTy(1) &&
X->getType() ==
Y->getType() &&
576 (
I->getOperand(0)->hasOneUse() ||
I->getOperand(1)->hasOneUse())) {
597 return disableWrapFlagsBasedOnUnusedHighBits(
I, NLZ);
603 APInt DemandedFromLHS = DemandedFromOps;
607 return disableWrapFlagsBasedOnUnusedHighBits(
I, NLZ);
609 unsigned NtzLHS = (~DemandedMask & LHSKnown.Zero).
countr_one();
610 APInt DemandedFromRHS = DemandedFromOps;
613 return disableWrapFlagsBasedOnUnusedHighBits(
I, NLZ);
618 return I->getOperand(0);
619 if (DemandedFromOps.
isSubsetOf(LHSKnown.Zero))
620 return I->getOperand(1);
629 return Builder.CreateXor(
I->getOperand(0), ConstantInt::get(VTy, *
C));
639 case Instruction::Sub: {
646 return disableWrapFlagsBasedOnUnusedHighBits(
I, NLZ);
652 APInt DemandedFromLHS = DemandedFromOps;
656 return disableWrapFlagsBasedOnUnusedHighBits(
I, NLZ);
661 return I->getOperand(0);
664 if (DemandedFromOps.
isOne() && DemandedFromOps.
isSubsetOf(LHSKnown.Zero))
665 return I->getOperand(1);
673 return Builder.CreateNot(
I->getOperand(1));
682 case Instruction::Mul: {
683 APInt DemandedFromOps;
684 if (simplifyOperandsBasedOnUnusedHighBits(DemandedFromOps))
694 Constant *ShiftC = ConstantInt::get(VTy, CTZ);
695 Instruction *Shl = BinaryOperator::CreateShl(
I->getOperand(0), ShiftC);
702 if (
I->getOperand(0) ==
I->getOperand(1) && DemandedMask.
ult(4)) {
703 Constant *One = ConstantInt::get(VTy, 1);
704 Instruction *And1 = BinaryOperator::CreateAnd(
I->getOperand(0), One);
711 case Instruction::Shl: {
718 DemandedMask,
Known))
722 if (
I->hasOneUse()) {
724 if (Inst->
getOpcode() == BinaryOperator::Or) {
726 auto [IID, FShiftArgs] = *Opt;
727 if ((IID == Intrinsic::fshl || IID == Intrinsic::fshr) &&
728 FShiftArgs[0] == FShiftArgs[1]) {
740 if (
I->hasNoSignedWrap()) {
744 if (SignBits > ShiftAmt && SignBits - ShiftAmt >= NumHiDemandedBits)
745 return I->getOperand(0);
755 Constant *LeftShiftAmtC = ConstantInt::get(VTy, ShiftAmt);
759 LeftShiftAmtC,
DL) ==
C) {
760 Instruction *Lshr = BinaryOperator::CreateLShr(NewC,
X);
766 APInt DemandedMaskIn(DemandedMask.
lshr(ShiftAmt));
790 I->dropPoisonGeneratingFlags();
798 case Instruction::LShr: {
804 if (
I->hasOneUse()) {
806 if (Inst->
getOpcode() == BinaryOperator::Or) {
808 auto [IID, FShiftArgs] = *Opt;
809 if ((IID == Intrinsic::fshl || IID == Intrinsic::fshr) &&
810 FShiftArgs[0] == FShiftArgs[1]) {
826 if (SignBits >= NumHiDemandedBits)
827 return I->getOperand(0);
836 Constant *RightShiftAmtC = ConstantInt::get(VTy, ShiftAmt);
840 RightShiftAmtC,
DL) ==
C) {
847 if (
match(
I->getOperand(0),
851 X, ConstantInt::get(
X->getType(), Factor->
lshr(ShiftAmt)));
857 APInt DemandedMaskIn(DemandedMask.
shl(ShiftAmt));
860 I->dropPoisonGeneratingFlags();
865 Known.Zero.setHighBits(ShiftAmt);
875 case Instruction::AShr: {
881 if (SignBits >= NumHiDemandedBits)
882 return I->getOperand(0);
888 if (DemandedMask.
isOne()) {
891 I->getOperand(0),
I->getOperand(1),
I->getName());
900 APInt DemandedMaskIn(DemandedMask.
shl(ShiftAmt));
903 bool ShiftedInBitsDemanded = DemandedMask.
countl_zero() < ShiftAmt;
904 if (ShiftedInBitsDemanded)
908 I->dropPoisonGeneratingFlags();
924 ShiftAmt != 0,
I->isExact());
930 case Instruction::UDiv: {
936 APInt DemandedMaskIn =
941 I->dropPoisonGeneratingFlags();
952 case Instruction::SRem: {
955 if (DemandedMask.
ult(*Rem))
956 return I->getOperand(0);
958 APInt LowBits = *Rem - 1;
969 case Instruction::Call: {
970 bool KnownBitsComputed =
false;
972 switch (
II->getIntrinsicID()) {
973 case Intrinsic::abs: {
974 if (DemandedMask == 1)
975 return II->getArgOperand(0);
978 case Intrinsic::ctpop: {
986 II->getModule(), Intrinsic::ctpop, VTy);
991 case Intrinsic::bswap: {
1008 NewVal = BinaryOperator::CreateLShr(
1009 II->getArgOperand(0), ConstantInt::get(VTy, NLZ - NTZ));
1011 NewVal = BinaryOperator::CreateShl(
1012 II->getArgOperand(0), ConstantInt::get(VTy, NTZ - NLZ));
1018 case Intrinsic::ptrmask: {
1019 unsigned MaskWidth =
I->getOperand(1)->getType()->getScalarSizeInBits();
1024 I, 1, (DemandedMask & ~LHSKnown.Zero).zextOrTrunc(MaskWidth),
1025 RHSKnown, Q,
Depth + 1))
1031 Known = LHSKnown & RHSKnown;
1032 KnownBitsComputed =
true;
1047 if (DemandedMask.
isSubsetOf(RHSKnown.One | LHSKnown.Zero))
1048 return I->getOperand(0);
1052 I, 1, (DemandedMask & ~LHSKnown.Zero).zextOrTrunc(MaskWidth)))
1061 uint64_t PtrMaskImmediate;
1068 if (!LHSKnown.isZero()) {
1069 const unsigned trailingZeros = LHSKnown.countMinTrailingZeros();
1070 uint64_t PointerAlignBits = (
uint64_t(1) << trailingZeros) - 1;
1072 uint64_t HighBitsGEPIndex = GEPIndex & ~PointerAlignBits;
1073 uint64_t MaskedLowBitsGEPIndex =
1074 GEPIndex & PointerAlignBits & PtrMaskImmediate;
1076 uint64_t MaskedGEPIndex = HighBitsGEPIndex | MaskedLowBitsGEPIndex;
1078 if (MaskedGEPIndex != GEPIndex) {
1081 Type *GEPIndexType =
1082 DL.getIndexType(
GEP->getPointerOperand()->getType());
1084 GEP->getSourceElementType(), InnerPtr,
1085 ConstantInt::get(GEPIndexType, MaskedGEPIndex),
1086 GEP->getName(),
GEP->isInBounds());
1097 case Intrinsic::fshr:
1098 case Intrinsic::fshl: {
1106 if (
II->getIntrinsicID() == Intrinsic::fshr)
1109 APInt DemandedMaskLHS(DemandedMask.
lshr(ShiftAmt));
1111 if (
I->getOperand(0) !=
I->getOperand(1)) {
1117 I->dropPoisonGeneratingAnnotations();
1124 if (DemandedMaskLHS.
isSubsetOf(LHSKnown.Zero | LHSKnown.One) &&
1128 I->dropPoisonGeneratingAnnotations();
1137 I->dropPoisonGeneratingAnnotations();
1142 LHSKnown <<= ShiftAmt;
1144 Known = LHSKnown.unionWith(RHSKnown);
1145 KnownBitsComputed =
true;
1148 case Intrinsic::umax: {
1155 CTZ >=
C->getActiveBits())
1156 return II->getArgOperand(0);
1159 case Intrinsic::umin: {
1167 CTZ >=
C->getBitWidth() -
C->countl_one())
1168 return II->getArgOperand(0);
1174 *
II, DemandedMask,
Known, KnownBitsComputed);
1182 if (!KnownBitsComputed)
1188 if (
I->getType()->isPointerTy()) {
1189 Align Alignment =
I->getPointerAlignment(
DL);
1197 if (!
I->getType()->isPointerTy() &&
1201 if (
CLOpts.verify_known_bits) {
1203 if (
Known != ReferenceKnown) {
1204 errs() <<
"Mismatched known bits for " << *
I <<
" in "
1205 <<
I->getFunction()->getName() <<
"\n";
1206 errs() <<
"computeKnownBits(): " << ReferenceKnown <<
"\n";
1207 errs() <<
"SimplifyDemandedBits(): " <<
Known <<
"\n";
1222 Type *ITy =
I->getType();
1231 switch (
I->getOpcode()) {
1232 case Instruction::And: {
1247 return I->getOperand(0);
1249 return I->getOperand(1);
1253 case Instruction::Or: {
1270 return I->getOperand(0);
1272 return I->getOperand(1);
1276 case Instruction::Xor: {
1292 return I->getOperand(0);
1294 return I->getOperand(1);
1298 case Instruction::Add: {
1306 return I->getOperand(0);
1310 return I->getOperand(1);
1318 case Instruction::Sub: {
1326 return I->getOperand(0);
1335 case Instruction::AShr: {
1348 const APInt *ShiftRC;
1349 const APInt *ShiftLC;
1397 if (!ShlOp1 || !ShrOp1)
1402 unsigned BitWidth = Ty->getScalarSizeInBits();
1409 Known.One.clearAllBits();
1410 Known.Zero.setLowBits(ShlAmt - 1);
1411 Known.Zero &= DemandedMask;
1416 bool isLshr = (Shr->
getOpcode() == Instruction::LShr);
1417 BitMask1 = isLshr ? (BitMask1.
lshr(ShrAmt) << ShlAmt) :
1418 (BitMask1.
ashr(ShrAmt) << ShlAmt);
1420 if (ShrAmt <= ShlAmt) {
1421 BitMask2 <<= (ShlAmt - ShrAmt);
1423 BitMask2 = isLshr ? BitMask2.
lshr(ShrAmt - ShlAmt):
1424 BitMask2.
ashr(ShrAmt - ShlAmt);
1428 if ((BitMask1 & DemandedMask) == (BitMask2 & DemandedMask)) {
1429 if (ShrAmt == ShlAmt)
1436 if (ShrAmt < ShlAmt) {
1438 New = BinaryOperator::CreateShl(VarX, Amt);
1444 New = isLshr ? BinaryOperator::CreateLShr(VarX, Amt) :
1445 BinaryOperator::CreateAShr(VarX, Amt);
1447 New->setIsExact(
true);
1462 unsigned DepthLimit) {
1465 if (!IE.hasOneUse())
1468 if (!UserIE || UserIE->getOperand(0) != &IE)
1476 if (!Idx || Idx->getValue().uge(VWidth))
1479 unsigned Index = Idx->getZExtValue();
1480 if (SeenIndices.
test(Index))
1483 SeenIndices.
set(Index);
1488 for (
unsigned I = 0;
I != DepthLimit; ++
I) {
1493 if (!HasNewIndexInRange(*Cur))
1501 if (!Cur || !Cur->hasOneUse())
1525 bool AllowMultipleUsers) {
1533 assert((DemandedElts & ~EltMask) == 0 &&
"Invalid DemandedElts!");
1537 PoisonElts = EltMask;
1541 if (DemandedElts.
isZero()) {
1542 PoisonElts = EltMask;
1557 for (
unsigned i = 0; i != VWidth; ++i) {
1558 if (!DemandedElts[i]) {
1564 Constant *Elt =
C->getAggregateElement(i);
1565 if (!Elt)
return nullptr;
1574 return NewCV !=
C ? NewCV :
nullptr;
1581 if (!AllowMultipleUsers) {
1585 if (!V->hasOneUse()) {
1594 DemandedElts = EltMask;
1599 if (!
I)
return nullptr;
1601 bool MadeChange =
false;
1602 auto simplifyAndSetOp = [&](
Instruction *Inst,
unsigned OpNum,
1612 APInt PoisonElts2(VWidth, 0);
1613 APInt PoisonElts3(VWidth, 0);
1614 switch (
I->getOpcode()) {
1617 case Instruction::GetElementPtr: {
1635 for (
unsigned i = 0; i <
I->getNumOperands(); i++) {
1639 PoisonElts = EltMask;
1642 if (
I->getOperand(i)->getType()->isVectorTy()) {
1643 APInt PoisonEltsOp(VWidth, 0);
1644 simplifyAndSetOp(
I, i, DemandedElts, PoisonEltsOp);
1649 PoisonElts |= PoisonEltsOp;
1655 case Instruction::InsertElement: {
1656 unsigned DepthLimit =
CLOpts.simplify_vector_elts_depth;
1659 if (
Depth == 0 && DemandedElts.
isAllOnes() && VWidth > DepthLimit &&
1669 simplifyAndSetOp(
I, 0, DemandedElts, PoisonElts2);
1675 unsigned IdxNo = Idx->getZExtValue();
1676 APInt PreInsertDemandedElts = DemandedElts;
1678 PreInsertDemandedElts.
clearBit(IdxNo);
1686 if (PreInsertDemandedElts == 0 &&
1693 simplifyAndSetOp(
I, 0, PreInsertDemandedElts, PoisonElts);
1697 if (IdxNo >= VWidth || !DemandedElts[IdxNo]) {
1699 return I->getOperand(0);
1706 case Instruction::ShuffleVector: {
1708 assert(Shuffle->getOperand(0)->getType() ==
1709 Shuffle->getOperand(1)->getType() &&
1710 "Expected shuffle operands to have same type");
1721 APInt LeftDemanded(OpWidth, 1);
1722 APInt LHSPoisonElts(OpWidth, 0);
1723 simplifyAndSetOp(
I, 0, LeftDemanded, LHSPoisonElts);
1724 if (LHSPoisonElts[0])
1725 PoisonElts = EltMask;
1731 APInt LeftDemanded(OpWidth, 0), RightDemanded(OpWidth, 0);
1732 for (
unsigned i = 0; i < VWidth; i++) {
1733 if (DemandedElts[i]) {
1734 unsigned MaskVal = Shuffle->getMaskValue(i);
1735 if (MaskVal != -1u) {
1736 assert(MaskVal < OpWidth * 2 &&
1737 "shufflevector mask index out of range!");
1738 if (MaskVal < OpWidth)
1739 LeftDemanded.setBit(MaskVal);
1741 RightDemanded.
setBit(MaskVal - OpWidth);
1746 APInt LHSPoisonElts(OpWidth, 0);
1747 simplifyAndSetOp(
I, 0, LeftDemanded, LHSPoisonElts);
1749 APInt RHSPoisonElts(OpWidth, 0);
1750 simplifyAndSetOp(
I, 1, RightDemanded, RHSPoisonElts);
1763 if (VWidth == OpWidth) {
1764 bool IsIdentityShuffle =
true;
1765 for (
unsigned i = 0; i < VWidth; i++) {
1766 unsigned MaskVal = Shuffle->getMaskValue(i);
1767 if (DemandedElts[i] && i != MaskVal) {
1768 IsIdentityShuffle =
false;
1772 if (IsIdentityShuffle)
1773 return Shuffle->getOperand(0);
1776 bool NewPoisonElts =
false;
1777 unsigned LHSIdx = -1u, LHSValIdx = -1u;
1778 unsigned RHSIdx = -1u, RHSValIdx = -1u;
1779 bool LHSUniform =
true;
1780 bool RHSUniform =
true;
1781 for (
unsigned i = 0; i < VWidth; i++) {
1782 unsigned MaskVal = Shuffle->getMaskValue(i);
1783 if (MaskVal == -1u) {
1785 }
else if (!DemandedElts[i]) {
1786 NewPoisonElts =
true;
1788 }
else if (MaskVal < OpWidth) {
1789 if (LHSPoisonElts[MaskVal]) {
1790 NewPoisonElts =
true;
1793 LHSIdx = LHSIdx == -1u ? i : OpWidth;
1794 LHSValIdx = LHSValIdx == -1u ? MaskVal : OpWidth;
1795 LHSUniform = LHSUniform && (MaskVal == i);
1798 if (RHSPoisonElts[MaskVal - OpWidth]) {
1799 NewPoisonElts =
true;
1802 RHSIdx = RHSIdx == -1u ? i : OpWidth;
1803 RHSValIdx = RHSValIdx == -1u ? MaskVal - OpWidth : OpWidth;
1804 RHSUniform = RHSUniform && (MaskVal - OpWidth == i);
1820 if (LHSIdx < OpWidth && RHSUniform) {
1822 Op = Shuffle->getOperand(1);
1823 Value = CV->getOperand(LHSValIdx);
1827 if (RHSIdx < OpWidth && LHSUniform) {
1829 Op = Shuffle->getOperand(0);
1830 Value = CV->getOperand(RHSValIdx);
1843 if (NewPoisonElts) {
1846 for (
unsigned i = 0; i < VWidth; ++i) {
1850 Elts.
push_back(Shuffle->getMaskValue(i));
1852 Shuffle->setShuffleMask(Elts);
1857 case Instruction::Select: {
1867 simplifyAndSetOp(
I, 0, DemandedElts, PoisonElts);
1871 APInt DemandedLHS(DemandedElts), DemandedRHS(DemandedElts);
1873 for (
unsigned i = 0; i < VWidth; i++) {
1878 DemandedLHS.clearBit(i);
1884 simplifyAndSetOp(
I, 1, DemandedLHS, PoisonElts2);
1885 simplifyAndSetOp(
I, 2, DemandedRHS, PoisonElts3);
1889 PoisonElts = PoisonElts2 & PoisonElts3;
1892 case Instruction::BitCast: {
1897 APInt InputDemandedElts(InVWidth, 0);
1898 PoisonElts2 =
APInt(InVWidth, 0);
1901 if (VWidth == InVWidth) {
1905 InputDemandedElts = DemandedElts;
1906 }
else if ((VWidth % InVWidth) == 0) {
1910 Ratio = VWidth / InVWidth;
1911 for (
unsigned OutIdx = 0; OutIdx != VWidth; ++OutIdx)
1912 if (DemandedElts[OutIdx])
1913 InputDemandedElts.
setBit(OutIdx / Ratio);
1914 }
else if ((InVWidth % VWidth) == 0) {
1918 Ratio = InVWidth / VWidth;
1919 for (
unsigned InIdx = 0; InIdx != InVWidth; ++InIdx)
1920 if (DemandedElts[InIdx / Ratio])
1921 InputDemandedElts.
setBit(InIdx);
1927 simplifyAndSetOp(
I, 0, InputDemandedElts, PoisonElts2);
1929 if (VWidth == InVWidth) {
1930 PoisonElts = PoisonElts2;
1931 }
else if ((VWidth % InVWidth) == 0) {
1935 for (
unsigned OutIdx = 0; OutIdx != VWidth; ++OutIdx)
1936 if (PoisonElts2[OutIdx / Ratio])
1937 PoisonElts.
setBit(OutIdx);
1938 }
else if ((InVWidth % VWidth) == 0) {
1942 for (
unsigned OutIdx = 0; OutIdx != VWidth; ++OutIdx) {
1945 PoisonElts.
setBit(OutIdx);
1952 case Instruction::FPTrunc:
1953 case Instruction::FPExt:
1954 simplifyAndSetOp(
I, 0, DemandedElts, PoisonElts);
1957 case Instruction::Call: {
1960 switch (
II->getIntrinsicID()) {
1961 case Intrinsic::masked_gather:
1962 case Intrinsic::masked_load: {
1967 DemandedPassThrough(DemandedElts);
1969 for (
unsigned i = 0; i < VWidth; i++) {
1971 if (CElt->isNullValue())
1972 DemandedPtrs.clearBit(i);
1973 else if (CElt->isAllOnesValue())
1979 if (
II->getIntrinsicID() == Intrinsic::masked_gather)
1980 simplifyAndSetOp(
II, 0, DemandedPtrs, PoisonElts2);
1981 simplifyAndSetOp(
II, 2, DemandedPassThrough, PoisonElts3);
1985 PoisonElts = PoisonElts2 & PoisonElts3;
1988 case Intrinsic::vector_shuffle: {
1991 simplifyAndSetOp(
II, 1, DemandedElts, PoisonElts);
1996 II->getArgOperand(1),
false,
SQ.getWithInstruction(
II));
2002 simplifyAndSetOp(
II, 0, DemandedSrc, PoisonElts3);
2008 *
II, DemandedElts, PoisonElts, PoisonElts2, PoisonElts3,
2018 APInt PoisonEltsAcc(VWidth, 0);
2019 for (
Use &Arg :
II->args()) {
2020 unsigned OpNo = Arg.getOperandNo();
2024 APInt OpPoisonElts(VWidth, 0);
2025 simplifyAndSetOp(
II, OpNo, DemandedElts, OpPoisonElts);
2026 PoisonEltsAcc |= OpPoisonElts;
2031 PoisonElts = PoisonEltsAcc;
2063 if (DemandedElts == 1 && !
X->hasOneUse() && !
Y->hasOneUse() &&
2066 auto findShufBO = [&](
bool MatchShufAsOp0) ->
User * {
2071 Value *OtherOp = MatchShufAsOp0 ?
Y :
X;
2076 Value *ShufOp = MatchShufAsOp0 ?
X :
Y;
2087 if (
DT.dominates(U,
I))
2093 User *ShufBO = findShufBO(
true);
2095 ShufBO = findShufBO(
false);
2098 ShufBOI->andIRFlags(BO);
2104 simplifyAndSetOp(
I, 0, DemandedElts, PoisonElts);
2105 simplifyAndSetOp(
I, 1, DemandedElts, PoisonElts2);
2109 PoisonElts &= PoisonElts2;
2117 return MadeChange ?
I :
nullptr;
2123 bool IsCanonicalizing =
false) {
2131 if (Ty->isAggregateType())
2135 if (Mask ==
fcNan && IsCanonicalizing)
2174 Known.knownNot(~DemandedMask);
2208 return DemandedMask;
2226 if (InferredFMF != FMF) {
2227 FPOp->dropUBImplyingAttrsAndMetadata();
2228 FPOp->setFastMathFlags(InferredFMF);
2256 Known.knownNot(~DemandedMask);
2268 if ((DemandedMask & ~NegOrZero) ==
fcNone &&
2272 if ((DemandedMask & ~PosOrZero) ==
fcNone &&
2292 bool OrderedZeroSign = !NSZ;
2296 case Intrinsic::maximum: {
2315 case Intrinsic::minimum: {
2334 case Intrinsic::maxnum:
2335 case Intrinsic::maximumnum: {
2353 case Intrinsic::minnum:
2354 case Intrinsic::minimumnum: {
2379 Known.knownNot(~DemandedMask);
2390 const fltSemantics &DstTy =
I.getType()->getScalarType()->getFltSemantics();
2392 I.getOperand(0)->getType()->getScalarType()->getFltSemantics();
2401 if (DemandedMask &
fcNan)
2402 SrcDemandedMask |=
fcNan;
2416 const bool SubnormalNeverProducesNormal =
2421 if (!SubnormalNeverProducesNormal) {
2430 const bool PosOverflowIsNeverPosInf =
2432 const bool NegOverflowIsNeverNegInf =
2435 if ((DemandedMask &
fcPosInf) && !PosOverflowIsNeverPosInf)
2437 if ((DemandedMask &
fcNegInf) && !NegOverflowIsNeverNegInf)
2457 Known.knownNot(~DemandedMask);
2471 Type *VTy =
I->getType();
2475 FMF =
FPOp->getFastMathFlags();
2479 switch (
I->getOpcode()) {
2480 case Instruction::FNeg: {
2483 Value *FNegSrc =
I->getOperand(0);
2498 Known, FNegFAbsSrc, ThisDemandedMask, KnownSrc, IsNSZ))
2522 Known.knownNot(~DemandedMask);
2525 case Instruction::FAdd:
2526 case Instruction::FSub: {
2530 if (
I->getOperand(0) ==
I->getOperand(1) &&
2531 I->getOpcode() == Instruction::FAdd &&
2538 if (DemandedMask &
fcNan)
2539 SrcDemandedMask |=
fcNan;
2552 if (Mode.inputsMayBePositiveZero() || Mode.outputsMayBePositiveZero())
2572 KnownRHS = KnownLHS;
2577 if (DemandedMask &
fcNan)
2580 if (DemandedMask &
fcInf)
2581 SrcDemandedMask |=
fcInf;
2592 Known =
I->getOpcode() == Instruction::FAdd
2599 Known.knownNot(~DemandedMask);
2606 bool ResultNotNan = (DemandedMask &
fcNan) ==
fcNone;
2609 if (ResultNotNan &&
I->getOpcode() == Instruction::FAdd &&
2611 return I->getOperand(1);
2617 return I->getOperand(0);
2620 FMF,
Known.getKnownFPClasses(), {KnownLHS, KnownRHS});
2621 if (InferredFMF != FMF) {
2622 I->setFastMathFlags(InferredFMF);
2628 case Instruction::FMul: {
2637 if (DemandedMask &
fcInf) {
2643 if (DemandedMask &
fcNan) {
2657 if (DemandedMask &
fcZero)
2669 Known.knownNot(~DemandedMask);
2704 bool NonNanResult = (DemandedMask &
fcNan) ==
fcNone;
2787 Known.knownNot(~DemandedMask);
2794 FMF,
Known.getKnownFPClasses(), {KnownLHS, KnownRHS});
2795 if (InferredFMF != FMF) {
2796 I->setFastMathFlags(InferredFMF);
2802 case Instruction::FDiv: {
2818 Value *IsInfOrZeroOrNan =
Builder.CreateOr(IsInfOrNan, IsZeroOrNan);
2820 return Builder.CreateSelectFMFWithUnknownProfile(
2841 if (DemandedMask &
fcNan) {
2852 if (DemandedMask &
fcZero)
2859 if (DemandedMask &
fcZero) {
2861 "should not have to worry about daz here");
2862 LHSDemandedMask |=
fcZero;
2863 RHSDemandedMask |=
fcInf;
2870 if (DemandedMask &
fcInf) {
2881 bool ResultNotNan = (DemandedMask &
fcNan) ==
fcNone;
2882 bool ResultNotInf = (DemandedMask &
fcInf) ==
fcNone;
2887 bool CanIgnoreZeroByZeroNan =
2896 CanIgnoreZeroByZeroNan) {
2907 if (!ResultNotInf &&
2928 Known.knownNot(~DemandedMask);
2935 FMF,
Known.getKnownFPClasses(), {KnownLHS, KnownRHS});
2936 if (InferredFMF != FMF) {
2937 I->setFastMathFlags(InferredFMF);
2943 case Instruction::FPTrunc:
2947 case Instruction::FPExt: {
2950 I->getOperand(0)->getType()->getScalarType()->getFltSemantics();
2956 if (DemandedMask &
fcNan)
2957 SrcDemandedMask |=
fcNan;
2983 Known.knownNot(~DemandedMask);
2988 case Instruction::Call: {
2992 case Intrinsic::fabs: {
3004 case Intrinsic::arithmetic_fence:
3008 case Intrinsic::copysign: {
3016 if ((DemandedMask &
fcNegative) == DemandedMask &&
3019 CI->
setOperand(1, ConstantFP::get(VTy, -1.0));
3023 if ((DemandedMask &
fcPositive) == DemandedMask &&
3056 CI->
setOperand(1, ConstantFP::get(VTy, -1.0));
3061 Known.knownNot(~DemandedMask);
3064 case Intrinsic::fma:
3065 case Intrinsic::fmuladd: {
3071 if (DemandedMask &
fcNan)
3072 SrcDemandedMask |=
fcNan;
3076 const bool IsFMA = IID == Intrinsic::fma;
3088 KnownSrc[1] = KnownSrc[0];
3094 for (
int OpIdx = 0; OpIdx != 3; ++OpIdx) {
3096 KnownSrc[OpIdx],
SQ,
Depth + 1))
3110 case Intrinsic::maximum:
3111 case Intrinsic::minimum:
3112 case Intrinsic::maximumnum:
3113 case Intrinsic::minimumnum:
3114 case Intrinsic::maxnum:
3115 case Intrinsic::minnum: {
3116 const bool PropagateNaN =
3117 IID == Intrinsic::maximum || IID == Intrinsic::minimum;
3123 PropagateNaN && ((DemandedMask &
fcNan) ==
fcNone)
3124 ? DemandedMask | ~
fcNan
3155 bool ResultNotLogical0 = (ValidResults & ZeroMask) ==
fcNone;
3164 ((PropagateNaN && (ValidResults &
fcNan) ==
fcNone) ||
3170 if (InferredFMF != FMF) {
3177 case Intrinsic::exp:
3178 case Intrinsic::exp2:
3179 case Intrinsic::exp10: {
3225 return ConstantFP::get(VTy, 1.0);
3242 ConstantFP::get(VTy, 1.0), FMF);
3257 Value *ZeroOrInf =
Builder.CreateSelectFMFWithUnknownProfile(
3263 Known.knownNot(~DemandedMask);
3268 case Intrinsic::log:
3269 case Intrinsic::log2:
3270 case Intrinsic::log10: {
3275 if (DemandedMask &
fcNan)
3276 DemandedSrcMask |=
fcNan;
3290 if (DemandedMask &
fcNan)
3295 DemandedSrcMask |=
fcZero;
3298 if (Mode.inputsMayBeZero())
3306 if (DemandedMask &
fcZero)
3315 Known.knownNot(~DemandedMask);
3320 case Intrinsic::sqrt: {
3326 if (DemandedMask &
fcSNan)
3327 DemandedSrcMask |=
fcSNan;
3328 if (DemandedMask &
fcQNan)
3339 if (Mode.inputsMayBeZero())
3341 if (Mode.inputsMayBePositiveZero())
3354 KnownSrc.
knownNot(~DemandedSrcMask);
3364 Known.knownNot(~DemandedMask);
3383 case Intrinsic::ldexp: {
3389 if (DemandedMask &
fcNan)
3390 SrcDemandedMask |=
fcNan;
3406 if (Mode.inputsMayBePositiveZero())
3408 if (Mode.outputsMayBePositiveZero())
3423 Known.knownNot(~DemandedMask);
3428 case Intrinsic::trunc:
3429 case Intrinsic::floor:
3430 case Intrinsic::ceil:
3431 case Intrinsic::rint:
3432 case Intrinsic::nearbyint:
3433 case Intrinsic::round:
3434 case Intrinsic::roundeven: {
3439 if (DemandedMask &
fcNan)
3440 DemandedSrcMask |=
fcNan;
3444 if (IsMultiUnitFPType) {
3445 if (IID != Intrinsic::trunc && IID != Intrinsic::floor &&
3448 if (IID != Intrinsic::trunc && IID != Intrinsic::ceil &&
3459 if (Mode.inputsMayBePositiveZero())
3478 bool IsRoundNearestOrTrunc =
3479 IID == Intrinsic::round || IID == Intrinsic::roundeven ||
3480 IID == Intrinsic::nearbyint || IID == Intrinsic::rint ||
3481 IID == Intrinsic::trunc;
3483 if ((IID == Intrinsic::floor || IsRoundNearestOrTrunc) &&
3487 if ((IID == Intrinsic::ceil || IsRoundNearestOrTrunc) &&
3489 !Mode.inputsMayBePositiveZero())
3493 !Mode.inputsMayBeZero())
3494 return ConstantFP::get(VTy, -1.0);
3497 !Mode.inputsMayBeZero())
3498 return ConstantFP::get(VTy, 1.0);
3501 case Intrinsic::trunc:
3504 case Intrinsic::floor:
3507 case Intrinsic::ceil:
3516 Known.knownNot(~DemandedMask);
3523 if ((IID == Intrinsic::trunc || IsRoundNearestOrTrunc) &&
3525 (!Mode.inputsMayBePositiveZero() ||
3538 if (InferredFMF != FMF) {
3546 case Intrinsic::fptrunc_round: {
3553 case Intrinsic::canonicalize: {
3565 SrcDemandedMask |=
fcSNan;
3571 if (Mode.inputsMayBePositiveZero() ||
3572 Mode.outputsMayBePositiveZero())
3598 Known.knownNot(~DemandedMask);
3615 if (InferredFMF != FMF) {
3628 Known.knownNot(~DemandedMask);
3634 case Instruction::Select: {
3641 return I->getOperand(2);
3643 return I->getOperand(1);
3650 Known.knownNot(~DemandedMask);
3653 case Instruction::ExtractElement: {
3657 Known.knownNot(~DemandedMask);
3660 case Instruction::InsertElement: {
3668 Known = KnownVec | KnownInserted;
3669 Known.knownNot(~DemandedMask);
3672 case Instruction::ShuffleVector: {
3680 Known = KnownLHS | KnownRHS;
3681 Known.knownNot(~DemandedMask);
3684 case Instruction::InsertValue: {
3690 Known = KnownAgg | KnownElt;
3693 case Instruction::ExtractValue: {
3699 case Intrinsic::frexp: {
3702 if (DemandedMask &
fcNan)
3703 SrcDemandedMask |=
fcNan;
3733 Known.setKnownFPClasses(
Known.getKnownFPClasses() & DemandedMask);
3742 return II->getArgOperand(0);
3758 case Instruction::PHI: {
3760 if (
Depth >= PhiRecursionLimit)
3768 for (
unsigned I = 0, E =
P->getNumIncomingValues();
I != E; ++
I) {
3778 P,
P->getOperandNumForIncomingValue(
I), DemandedMask, KnownSrc,
3781 P->setIncomingValueForBlock(PredBB,
P->getIncomingValue(
I));
3796 Known.knownNot(~DemandedMask);
3801 Known.knownNot(~DemandedMask);
3816 FMF =
FPOp->getFastMathFlags();
3820 switch (
I->getOpcode()) {
3821 case Instruction::Select: {
3827 return I->getOperand(1);
3832 return I->getOperand(2);
3839 Known.knownNot(~DemandedMask);
3842 case Instruction::FNeg: {
3846 Value *FNegSrc =
I->getOperand(0);
3861 Known, Src, ThisDemandedMask, KnownSrc,
false))
3865 case Instruction::Call: {
3869 case Intrinsic::fabs: {
3882 case Intrinsic::copysign: {
3894 Mag, DemandedMask, KnownMag,
false))
3912 case Intrinsic::maxnum:
3913 case Intrinsic::minnum:
3914 case Intrinsic::maximum:
3915 case Intrinsic::minimum:
3916 case Intrinsic::maximumnum:
3917 case Intrinsic::minimumnum: {
3928 KnownLHS, KnownRHS,
F,
3939 Known.knownNot(~DemandedMask);
3951 Use &U =
I->getOperandUse(OpNo);
3953 Type *VTy = V->getType();
3955 if (DemandedMask ==
fcNone) {
3967 Known.knownNot(~DemandedMask);
3983 if (!FoldedToConst || FoldedToConst == V)
3991 Known.knownNot(~DemandedMask);
4011 if (NewVal == V && U.get() != V)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AMDGPU Register Bank Select
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
bpf unwind BPF Unwind Lower
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
This file provides internal interfaces used to implement the InstCombine.
static Value * simplifyDemandedUseFPClassFPTrunc(InstCombinerImpl &IC, Instruction &I, RoundingMode RM, FastMathFlags FMF, FPClassTest DemandedMask, KnownFPClass &Known, const SimplifyQuery &SQ, unsigned Depth)
static Constant * getFPClassConstant(Type *Ty, FPClassTest Mask, bool IsCanonicalizing=false)
For floating-point classes that resolve to a single bit pattern, return that value.
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
static Value * simplifyDemandedFPClassFabs(KnownFPClass &Known, Value *Src, FPClassTest DemandedMask, KnownFPClass KnownSrc, bool NSZ)
Perform multiple-use aware simplfications for fabs(Src).
static Value * simplifyDemandedFPClassFnegFabs(KnownFPClass &Known, Value *Src, FPClassTest DemandedMask, KnownFPClass KnownSrc, bool NSZ)
Perform multiple-use aware simplfications for fneg(fabs(Src)).
static bool ShrinkDemandedConstant(Instruction *I, unsigned OpNo, const APInt &Demanded)
Check to see if the specified operand of the specified instruction is a constant integer.
static Value * simplifyShiftSelectingPackedElement(Instruction *I, const APInt &DemandedMask, InstCombinerImpl &IC, unsigned Depth)
Let N = 2 * M.
static Value * simplifyDemandedFPClassMinMax(KnownFPClass &Known, Intrinsic::ID IID, const CallInst *CI, FPClassTest DemandedMask, KnownFPClass KnownLHS, KnownFPClass KnownRHS, const Function &F, bool NSZ)
static bool canSkipDemandedEltsInInsertChain(InsertElementInst &IE, unsigned VWidth, unsigned DepthLimit)
Return true if the top-level all-lanes demanded-elements query can be skipped for an intermediate ins...
static Value * simplifyDemandedFPClassCopysignMag(Value *MagSrc, FPClassTest DemandedMask, KnownFPClass KnownSrc, bool NSZ)
static FPClassTest adjustDemandedMaskFromFlags(FPClassTest DemandedMask, FastMathFlags FMF)
static FastMathFlags inferFastMathValueFlags(FastMathFlags FMF, FPClassTest ValidResults, ArrayRef< KnownFPClass > Known)
Try to set an inferred no-nans or no-infs in FMF.
static Value * simplifyDemandedFPClassResult(Instruction *FPOp, FastMathFlags FMF, FPClassTest DemandedMask, KnownFPClass &Known, ArrayRef< KnownFPClass > KnownSrcs)
Apply epilog fixups to a floating-point intrinsic.
This file provides the interface for the instcombine pass implementation.
uint64_t IntrinsicInst * II
MachineBasicBlock * Folded
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
This file implements the SmallBitVector class.
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
static APFloat getOne(const fltSemantics &Sem, bool Negative=false)
Factory for Positive and Negative One.
Class for arbitrary precision integers.
static APInt getAllOnes(unsigned numBits)
Return an APInt of a specified width with all bits set.
void clearBit(unsigned BitPosition)
Set a given bit to 0.
static APInt getSignMask(unsigned BitWidth)
Get the SignMask for a specific bit width.
uint64_t getZExtValue() const
Get zero extended value.
void setHighBits(unsigned hiBits)
Set the top hiBits bits.
unsigned popcount() const
Count the number of bits set.
LLVM_ABI APInt zextOrTrunc(unsigned width) const
Zero extend or truncate to width.
unsigned getActiveBits() const
Compute the number of active bits in the value.
LLVM_ABI APInt trunc(unsigned width) const
Truncate to new width.
void setBit(unsigned BitPosition)
Set the given bit to 1 whose position is given as "bitPosition".
bool isAllOnes() const
Determine if all bits are set. This is true for zero-width values.
static APInt getBitsSet(unsigned numBits, unsigned loBit, unsigned hiBit)
Get a value with a block of bits set.
bool isZero() const
Determine if this value is zero, i.e. all bits are clear.
LLVM_ABI APInt urem(const APInt &RHS) const
Unsigned remainder operation.
void setSignBit()
Set the sign bit to 1.
unsigned getBitWidth() const
Return the number of bits in the APInt.
bool ult(const APInt &RHS) const
Unsigned less than comparison.
void clearAllBits()
Set every bit to 0.
unsigned countr_zero() const
Count the number of trailing zero bits.
unsigned countl_zero() const
The APInt version of std::countl_zero.
void clearLowBits(unsigned loBits)
Set bottom loBits bits to 0.
uint64_t getLimitedValue(uint64_t Limit=UINT64_MAX) const
If this value is smaller than the specified limit, return it, otherwise return the limit value.
APInt ashr(unsigned ShiftAmt) const
Arithmetic right-shift function.
APInt shl(unsigned shiftAmt) const
Left-shift function.
bool isSubsetOf(const APInt &RHS) const
This operation checks that all bits set in this APInt are also set in RHS.
bool isPowerOf2() const
Check if this APInt's value is a power of two greater than zero.
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Constructs an APInt value that has the bottom loBitsSet bits set.
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Constructs an APInt value that has the top hiBitsSet bits set.
bool isIntN(unsigned N) const
Check if this APInt has an N-bits unsigned integer value.
bool isOne() const
Determine if this is a value of 1.
APInt lshr(unsigned shiftAmt) const
Logical right-shift function.
bool uge(const APInt &RHS) const
Unsigned greater or equal comparison.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction; assumes that the block is well-formed.
BinaryOps getOpcode() const
Value * getArgOperand(unsigned i) const
LLVM_ABI Intrinsic::ID getIntrinsicID() const
Returns the intrinsic ID of the intrinsic called or Intrinsic::not_intrinsic if the called function i...
This class represents a function call, abstracting a target machine's calling convention.
static CallInst * Create(FunctionType *Ty, Value *F, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
This is the base class for all instructions that perform data casts.
@ FCMP_UEQ
1 0 0 1 True if unordered or equal
static LLVM_ABI ConstantFP * getZero(Type *Ty, bool Negative=false)
static LLVM_ABI ConstantFP * getQNaN(Type *Ty, bool Negative=false, APInt *Payload=nullptr)
static LLVM_ABI ConstantFP * getInfinity(Type *Ty, bool Negative=false)
This is the shared class of boolean and integer constants.
const APInt & getValue() const
Return the constant as an APInt value reference.
This class represents a range of values.
LLVM_ABI APInt getUnsignedMin() const
Return the smallest unsigned value contained in the ConstantRange.
LLVM_ABI APInt getUnsignedMax() const
Return the largest unsigned value contained in the ConstantRange.
static LLVM_ABI Constant * get(ArrayRef< Constant * > V)
This is an important base class in LLVM.
static LLVM_ABI Constant * getIntegerValue(Type *Ty, const APInt &V)
Return the value for an integer or pointer constant, or a vector thereof, with the given scalar value...
bool isNullValue() const
Return true if this is the value that would be returned by getNullValue.
static LLVM_ABI Constant * getAllOnesValue(Type *Ty)
LLVM_ABI bool isOneValue() const
Returns true if the value is one.
static LLVM_ABI Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
LLVM_ABI Constant * getAggregateElement(unsigned Elt) const
For aggregates (struct/array/vector) return the constant that corresponds to the specified element if...
A parsed version of the target data layout string in and methods for querying it.
Convenience struct for specifying and reasoning about fast-math flags.
bool noSignedZeros() const
void setNoSignedZeros(bool B=true)
void setNoNaNs(bool B=true)
void setNoInfs(bool B=true)
DenormalMode getDenormalMode(const fltSemantics &FPType) const
Returns the denormal handling type for the default rounding mode of the function.
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
Value * CreateICmpEQ(Value *LHS, Value *RHS, const Twine &Name="")
LLVM_ABI Value * CreateSelectWithUnknownProfile(Value *C, Value *True, Value *False, StringRef PassName, const Twine &Name="")
void SetInsertPoint(BasicBlock *TheBB)
This specifies that created instructions should be appended to the end of the specified block.
This instruction inserts a single (scalar) element into a VectorType value.
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
bool SimplifyDemandedInstructionFPClass(Instruction &Inst)
Value * SimplifyDemandedVectorElts(Value *V, APInt DemandedElts, APInt &PoisonElts, unsigned Depth=0, bool AllowMultipleUsers=false) override
The specified value produces a vector with any number of elements.
Value * SimplifyDemandedUseFPClass(Instruction *I, FPClassTest DemandedMask, KnownFPClass &Known, const SimplifyQuery &Q, unsigned Depth=0)
Attempts to replace V with a simpler value based on the demanded floating-point classes.
bool SimplifyDemandedBits(Instruction *I, unsigned Op, const APInt &DemandedMask, KnownBits &Known, const SimplifyQuery &Q, unsigned Depth=0) override
This form of SimplifyDemandedBits simplifies the specified instruction operand if possible,...
std::optional< std::pair< Intrinsic::ID, SmallVector< Value *, 3 > > > convertOrOfShiftsToFunnelShift(Instruction &Or)
Value * SimplifyMultipleUseDemandedFPClass(Instruction *I, FPClassTest DemandedMask, KnownFPClass &Known, const SimplifyQuery &Q, unsigned Depth)
Helper routine of SimplifyDemandedUseFPClass.
const InstCombineCLOptions & CLOpts
Value * simplifyShrShlDemandedBits(Instruction *Shr, const APInt &ShrOp1, Instruction *Shl, const APInt &ShlOp1, const APInt &DemandedMask, KnownBits &Known)
Helper routine of SimplifyDemandedUseBits.
bool SimplifyDemandedFPClass(Instruction *I, unsigned Op, FPClassTest DemandedMask, KnownFPClass &Known, const SimplifyQuery &Q, unsigned Depth=0)
Value * SimplifyDemandedUseBits(Instruction *I, const APInt &DemandedMask, KnownBits &Known, const SimplifyQuery &Q, unsigned Depth=0)
Attempts to replace I with a simpler value based on the demanded bits.
bool SimplifyDemandedInstructionBits(Instruction &Inst)
Tries to simplify operands to an integer instruction based on its demanded bits.
Value * SimplifyMultipleUseDemandedBits(Instruction *I, const APInt &DemandedMask, KnownBits &Known, const SimplifyQuery &Q, unsigned Depth=0)
Helper routine of SimplifyDemandedUseBits.
Instruction * replaceInstUsesWith(Instruction &I, Value *V)
A combiner-aware RAUW-like routine.
void replaceUse(Use &U, Value *NewValue)
Replace use and add the previously used value to the worklist.
InstructionWorklist & Worklist
A worklist of the instructions that need to be simplified.
Instruction * InsertNewInstWith(Instruction *New, BasicBlock::iterator Old)
Same as InsertNewInstBefore, but also sets the debug loc.
unsigned ComputeNumSignBits(const Value *Op, const Instruction *CtxI=nullptr, unsigned Depth=0) const
LLVM_ABI std::optional< Value * > targetSimplifyDemandedVectorEltsIntrinsic(IntrinsicInst &II, APInt DemandedElts, APInt &UndefElts, APInt &UndefElts2, APInt &UndefElts3, std::function< void(Instruction *, unsigned, APInt, APInt &)> SimplifyAndSetOp)
Instruction * replaceOperand(Instruction &I, unsigned OpNum, Value *V)
Replace operand of instruction and add old operand to the worklist.
LLVM_ABI std::optional< Value * > targetSimplifyDemandedUseBitsIntrinsic(IntrinsicInst &II, APInt DemandedMask, KnownBits &Known, bool &KnownBitsComputed)
void computeKnownBits(const Value *V, KnownBits &Known, const Instruction *CtxI, unsigned Depth=0) const
LLVM_ABI void dropUBImplyingAttrsAndMetadata(ArrayRef< unsigned > Keep={})
Drop any attributes or metadata that can cause immediate undefined behavior.
LLVM_ABI bool hasNoUnsignedWrap() const LLVM_READONLY
Determine whether the no unsigned wrap flag is set.
LLVM_ABI bool hasNoSignedWrap() const LLVM_READONLY
Determine whether the no signed wrap flag is set.
LLVM_ABI bool isCommutative() const LLVM_READONLY
Return true if the instruction is commutative:
LLVM_ABI void setFastMathFlags(FastMathFlags FMF)
Convenience function for setting multiple fast-math flags on this instruction, which must be an opera...
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
LLVM_ABI void setIsExact(bool b=true)
Set or clear the exact flag on this instruction, which must be an operator which supports this flag.
A wrapper class for inspecting calls to intrinsic functions.
bool isKnownNeverInfOrNaN() const
Return true if it's known this can never be an infinity or nan.
bool isKnownNeverInfinity() const
Return true if it's known this can never be an infinity.
static LLVM_ABI KnownFPClass fma(const KnownFPClass &LHS, const KnownFPClass &RHS, const KnownFPClass &Addend, DenormalMode Mode)
Report known values for fma.
static LLVM_ABI KnownFPClass fptrunc(const KnownFPClass &KnownSrc, const fltSemantics &DstTy, const fltSemantics &SrcTy, RoundingMode RM, DenormalMode DstMode, DenormalMode SrcMode)
Propagate known class for fptrunc and fptrunc_round.
static constexpr FPClassTest OrderedGreaterThanZeroMask
static constexpr FPClassTest OrderedLessThanZeroMask
static LLVM_ABI KnownFPClass trunc(const KnownFPClass &Src, DenormalMode Mode)
Propagate known class for trunc.
static LLVM_ABI KnownFPClass fadd(const KnownFPClass &LHS, const KnownFPClass &RHS, RoundingMode RM, DenormalMode Mode)
Report known values for fadd.
void copysign(const KnownFPClass &Sign)
bool isKnownNeverSubnormal() const
Return true if it's known this can never be a subnormal.
static LLVM_ABI KnownFPClass fsub(const KnownFPClass &LHS, const KnownFPClass &RHS, RoundingMode RM, DenormalMode Mode)
Report known values for fsub.
static LLVM_ABI KnownFPClass fma_square(const KnownFPClass &Squared, const KnownFPClass &Addend, DenormalMode Mode)
Report known values for fma squared, squared, addend.
static LLVM_ABI KnownFPClass fadd_self(const KnownFPClass &Src, RoundingMode RM, DenormalMode Mode)
Report known values for fadd x, x.
LLVM_ABI bool isKnownNeverLogicalZero(DenormalMode Mode) const
Return true if it's known this can never be interpreted as a zero.
static LLVM_ABI KnownFPClass ldexp(const KnownFPClass &Src, const APInt &ConstantRangeMin, const APInt &ConstantRangeMax, const fltSemantics &Flt, DenormalMode Mode)
Propagate known class for ldexp, assuming the exponent is known to be within [ConstantRangeMin,...
static LLVM_ABI KnownFPClass frexp_mant(const KnownFPClass &Src, DenormalMode Mode)
Propagate known class for mantissa component of frexp.
static LLVM_ABI KnownFPClass roundToIntegral(const KnownFPClass &Src, bool IsMultiUnitFPType, DenormalMode Mode)
Propagate known class for rounding intrinsics (rint, nearbyint, round, roundeven).
static LLVM_ABI KnownFPClass fmuladd(const KnownFPClass &LHS, const KnownFPClass &RHS, const KnownFPClass &Addend, DenormalMode Mode)
Report known values for fmuladd.
static LLVM_ABI KnownFPClass ceil(const KnownFPClass &Src, bool IsMultiUnitFPType, DenormalMode Mode)
Propagate known class for ceil.
static LLVM_ABI KnownFPClass fmuladd_square(const KnownFPClass &Squared, const KnownFPClass &Addend, DenormalMode Mode)
Report known values for fmuladd squared, squared, addend.
static LLVM_ABI KnownFPClass fpext(const KnownFPClass &KnownSrc, const fltSemantics &DstTy, const fltSemantics &SrcTy, DenormalMode DstMode, DenormalMode SrcMode)
Propagate known class for fpext.
KnownFPClass intersectWith(const KnownFPClass &RHS) const
static LLVM_ABI KnownFPClass exp(const KnownFPClass &Src)
Report known values for exp, exp2 and exp10.
bool isKnownNeverNaN() const
Return true if it's known this can never be a nan.
static LLVM_ABI KnownFPClass minMaxLike(const KnownFPClass &LHS, const KnownFPClass &RHS, MinMaxKind Kind, DenormalMode Mode)
void knownNot(FPClassMask RuleOut)
static LLVM_ABI KnownFPClass canonicalize(const KnownFPClass &Src, const fltSemantics &Flt, DenormalMode Mode)
Apply the canonicalize intrinsic to this value.
std::optional< bool > getSignBit() const
std::nullopt if the sign bit is unknown, true if the sign bit is definitely set or false if the sign ...
static LLVM_ABI KnownFPClass floor(const KnownFPClass &Src, bool IsMultiUnitFPType, DenormalMode Mode)
Propagate known class for floor.
FPClassTest getKnownFPClasses() const
Floating-point classes the value could be one of.
static LLVM_ABI KnownFPClass sqrt(const KnownFPClass &Src, DenormalMode Mode=DenormalMode::getDynamic())
Propagate known class for sqrt.
bool isKnownAlways(FPClassMask Mask) const
LLVM_ABI bool isKnownNeverLogicalPosZero(DenormalMode Mode) const
Return true if it's known this can never be interpreted as a positive zero.
bool isKnownNever(FPClassMask Mask) const
Return true if it's known this can never be one of the mask entries.
bool cannotBeOrderedGreaterEqZero(DenormalMode Mode) const
Return true if it's know this can never be a negative value or a logical 0.
LLVM_ABI bool isKnownNeverLogicalNegZero(DenormalMode Mode) const
Return true if it's known this can never be interpreted as a negative zero.
static LLVM_ABI KnownFPClass square(const KnownFPClass &Src, DenormalMode Mode)
static LLVM_ABI KnownFPClass log(const KnownFPClass &Src, DenormalMode Mode, bool IsMultiUnitFPType)
Propagate known class for log/log2/log10.
static LLVM_ABI KnownFPClass fdiv(const KnownFPClass &LHS, const KnownFPClass &RHS, DenormalMode Mode)
Report known values for fdiv.
static LLVM_ABI KnownFPClass fmul(const KnownFPClass &LHS, const KnownFPClass &RHS, DenormalMode Mode)
Report known values for fmul.
bool hasNoSignedWrap() const
Test whether this operation is known to never undergo signed overflow, aka the nsw property.
bool hasNoUnsignedWrap() const
Test whether this operation is known to never undergo unsigned overflow, aka the nuw property.
static LLVM_ABI PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
This class represents the LLVM 'select' instruction.
const Value * getCondition() const
This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is ...
bool test(unsigned Idx) const
Returns true if bit Idx is set.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI IntegerType * getInt64Ty(LLVMContext &C)
bool isVectorTy() const
True if this is an instance of VectorType.
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
bool isMultiUnitFPType() const
Returns true if this is a floating-point type that is an unevaluated sum of multiple floating-point u...
bool isIEEELikeFPTy() const
Return true if this is a well-behaved IEEE-like type, which has a IEEE compatible layout,...
LLVM_ABI const fltSemantics & getFltSemantics() const
static LLVM_ABI UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
A Use represents the edge between a Value definition and its users.
void setOperand(unsigned i, Value *Val)
Value * getOperand(unsigned i) const
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
bool hasOneUse() const
Return true if there is exactly one use of this value.
iterator_range< user_iterator > users()
bool hasUseList() const
Check if this Value has a use-list.
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
LLVM_ABI void takeName(Value *V)
Transfer the name from V to this value.
Base class of all SIMD vector types.
This class represents zero extension of integer types.
self_iterator getIterator()
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVM_ABI Function * getOrInsertDeclaration(Module *M, ID id, ArrayRef< Type * > OverloadTys={})
Look up the Function declaration of the intrinsic id in the Module M.
BinaryOp_match< SrcTy, SpecificConstantMatch, TargetOpcode::G_XOR, true > m_Not(const SrcTy &&Src)
Matches a register not-ed by a G_XOR.
OneUse_match< SubPat > m_OneUse(const SubPat &SP)
cst_pred_ty< is_lowbit_mask > m_LowBitMask()
Match an integer or vector with only the low bit(s) set.
BinaryOp_match< LHS, RHS, Instruction::Add > m_Add(const LHS &L, const RHS &R)
BinaryOp_match< LHS, RHS, Instruction::AShr > m_AShr(const LHS &L, const RHS &R)
auto m_Poison()
Match an arbitrary poison constant.
ap_match< APInt > m_APInt(const APInt *&Res)
Match a ConstantInt or splatted ConstantVector, binding the specified pointer to the contained APInt.
specific_intval< false > m_SpecificInt(const APInt &V)
Match a specific integer value or vector with all elements equal to the value.
bool match(Val *V, const Pattern &P)
specificval_ty m_Specific(const Value *V)
Match if we have a specific specified value.
BinOpPred_match< LHS, RHS, is_right_shift_op > m_Shr(const LHS &L, const RHS &R)
Matches logical shift operations.
TwoOps_match< Val_t, Idx_t, Instruction::ExtractElement > m_ExtractElt(const Val_t &Val, const Idx_t &Idx)
Matches ExtractElementInst.
auto m_BinOp()
Match an arbitrary binary operation and ignore it.
ExtractValue_match< Ind, Val_t > m_ExtractValue(const Val_t &V)
Match a single index ExtractValue instruction.
auto m_Value()
Match an arbitrary value and ignore it.
auto m_Ctpop(const Opnd0 &Op0)
BinaryOp_match< LHS, RHS, Instruction::Mul > m_Mul(const LHS &L, const RHS &R)
TwoOps_match< V1_t, V2_t, Instruction::ShuffleVector > m_Shuffle(const V1_t &v1, const V2_t &v2)
Matches ShuffleVectorInst independently of mask value.
CastInst_match< OpTy, ZExtInst > m_ZExt(const OpTy &Op)
Matches ZExt.
is_zero< true > m_Zero()
Match any null constant or a vector with all elements equal to 0.
PtrAdd_match< PointerOpTy, OffsetOpTy > m_PtrAdd(const DataLayout &DL, const PointerOpTy &PointerOp, const OffsetOpTy &OffsetOp)
Matches GEP with i8 source element type and canonical index type.
match_immconstant_ty m_ImmConstant()
Match an arbitrary immediate Constant and ignore it.
DisjointOr_match< LHS, RHS, true > m_c_DisjointOr(const LHS &L, const RHS &R)
BinaryOp_match< LHS, RHS, Instruction::Add, true > m_c_Add(const LHS &L, const RHS &R)
Matches a Add with LHS and RHS in either order.
auto m_Intrinsic(const Ts &...Ops)
Match intrinsic calls like this: m_Intrinsic<Intrinsic::fabs>(m_Value(X))
auto m_FAbs(const Opnd0 &Op0)
AnyBinaryOp_match< LHS, RHS, true > m_c_BinOp(const LHS &L, const RHS &R)
Matches a BinaryOperator with LHS and RHS in either order.
BinaryOp_match< LHS, RHS, Instruction::LShr > m_LShr(const LHS &L, const RHS &R)
CmpClass_match< LHS, RHS, ICmpInst > m_ICmp(CmpPredicate &Pred, const LHS &L, const RHS &R)
BinaryOp_match< LHS, RHS, Instruction::Shl > m_Shl(const LHS &L, const RHS &R)
auto m_Undef()
Match an arbitrary undef constant.
CastInst_match< OpTy, SExtInst > m_SExt(const OpTy &Op)
Matches SExt.
auto m_ConstantInt()
Match an arbitrary ConstantInt and ignore it.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI bool haveNoCommonBitsSet(const WithCache< const Value * > &LHSCache, const WithCache< const Value * > &RHSCache, const SimplifyQuery &SQ)
Return true if LHS and RHS have no common bits set.
LLVM_ABI KnownFPClass computeKnownFPClass(const Value *V, const APInt &DemandedElts, FPClassTest InterestedClasses, const SimplifyQuery &SQ, unsigned Depth=0)
Determine which floating-point classes are valid for V, and return them in KnownFPClass bit sets.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI void computeKnownBitsFromContext(const Value *V, KnownBits &Known, const SimplifyQuery &Q, unsigned Depth=0)
Merge bits known from context-dependent facts into Known.
@ Known
Known to have no common set bits.
@ Undef
Value of the register doesn't matter.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
int countr_one(T Value)
Count the number of ones from the least significant bit to the first zero bit.
LLVM_ABI void salvageDebugInfo(const MachineRegisterInfo &MRI, MachineInstr &MI)
Assuming the instruction MI is going to be deleted, attempt to salvage debug users of MI by writing t...
LLVM_ABI void computeKnownBits(const Value *V, KnownBits &Known, const DataLayout &DL, AssumptionCache *AC=nullptr, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr, bool UseInstrInfo=true, unsigned Depth=0)
Determine which bits of V are known to be either zero or one and return them in the KnownZero/KnownOn...
constexpr T alignDown(U Value, V Align, W Skew=0)
Returns the largest unsigned integer less than or equal to Value and is Skew mod Align.
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
gep_type_iterator gep_type_end(const User *GEP)
constexpr auto equal_to(T &&Arg)
Functor variant of std::equal_to that can be used as a UnaryPredicate in functional algorithms like a...
LLVM_ABI bool isGuaranteedNotToBeUndef(const Value *V, AssumptionCache *AC=nullptr, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr, unsigned Depth=0)
Returns true if V cannot be undef, but may be poison.
LLVM_ABI bool cannotOrderStrictlyLess(FPClassTest LHS, FPClassTest RHS, bool OrderedZeroSign=false)
Returns true if all values in LHS must be greater than or equal to those in RHS.
LLVM_ABI bool cannotOrderStrictlyGreater(FPClassTest LHS, FPClassTest RHS, bool OrderedZeroSign=false)
Returns true if all values in LHS must be less than or equal to those in RHS.
constexpr unsigned MaxAnalysisRecursionDepth
LLVM_ABI void adjustKnownBitsForSelectArm(KnownBits &Known, Value *Cond, Value *Arm, bool Invert, const SimplifyQuery &Q, unsigned Depth=0)
Adjust Known for the given select Arm to include information from the select Cond.
FPOp
The floating-point operations supported by the folding helpers.
LLVM_ABI FPClassTest fneg(FPClassTest Mask)
Return the test mask which returns true if the value's sign bit is flipped.
FPClassTest
Floating-point class tests, supported by 'is_fpclass' intrinsic.
LLVM_ABI void adjustKnownFPClassForSelectArm(KnownFPClass &Known, Value *Cond, Value *Arm, bool Invert, const SimplifyQuery &Q, unsigned Depth=0)
Adjust Known for the given select Arm to include information from the select Cond.
LLVM_ABI FPClassTest inverse_fabs(FPClassTest Mask)
Return the test mask which returns true after fabs is applied to the value.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
LLVM_ABI bool intrinsicPropagatesPoison(Intrinsic::ID IID)
Return whether this intrinsic propagates poison for all operands.
LLVM_ABI Constant * ConstantFoldBinaryOpOperands(unsigned Opcode, Constant *LHS, Constant *RHS, const DataLayout &DL)
Attempt to constant fold a binary operation with the specified operands.
constexpr int PoisonMaskElem
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
@ Mul
Product of integers.
@ Xor
Bitwise or logical XOR of integers.
LLVM_ABI bool isVectorIntrinsicWithScalarOpAtArg(Intrinsic::ID ID, unsigned ScalarOpdIdx, const TargetTransformInfo *TTI)
Identifies if the vector form of the intrinsic has a scalar operand.
LLVM_ABI ConstantRange computeConstantRangeIncludingKnownBits(const WithCache< const Value * > &V, bool ForSigned, const SimplifyQuery &SQ)
Combine constant ranges from computeConstantRange() and computeKnownBits().
LLVM_ABI FPClassTest unknown_sign(FPClassTest Mask)
Return the test mask which returns true if the value could have the same set of classes,...
DWARFExpression::Operation Op
RoundingMode
Rounding mode.
@ TowardZero
roundTowardZero.
@ NearestTiesToEven
roundTiesToEven.
@ TowardPositive
roundTowardPositive.
@ TowardNegative
roundTowardNegative.
constexpr unsigned BitWidth
LLVM_ABI KnownBits analyzeKnownBitsFromAndXorOr(const Operator *I, const KnownBits &KnownLHS, const KnownBits &KnownRHS, const SimplifyQuery &SQ, unsigned Depth=0)
Using KnownBits LHS/RHS produce the known bits for logic op (and/xor/or).
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI std::optional< RoundingMode > convertStrToRoundingMode(StringRef)
Returns a valid RoundingMode enumerator when given a string that is valid as input in constrained int...
gep_type_iterator gep_type_begin(const User *GEP)
unsigned Log2(Align A)
Returns the log2 of the alignment.
LLVM_ABI bool isTriviallyVectorizable(Intrinsic::ID ID)
Identify if the intrinsic is trivially vectorizable.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Represent subnormal handling kind for floating point instruction inputs and outputs.
@ PreserveSign
The sign of a flushed-to-zero number is preserved in the sign of 0.
@ Dynamic
Denormals have unknown treatment.
static constexpr DenormalMode getPreserveSign()
static constexpr DenormalMode getDynamic()
static constexpr DenormalMode getIEEE()
static KnownBits makeConstant(const APInt &C)
Create known bits from a known constant.
KnownBits anyextOrTrunc(unsigned BitWidth) const
Return known bits for an "any" extension or truncation of the value we're tracking.
bool isNonNegative() const
Returns true if this value is known to be non-negative.
void makeNonNegative()
Make this value non-negative.
static LLVM_ABI KnownBits ashr(const KnownBits &LHS, const KnownBits &RHS, bool ShAmtNonZero=false, bool Exact=false)
Compute known bits for ashr(LHS, RHS).
unsigned getBitWidth() const
Get the bit width of this value.
static KnownBits add(const KnownBits &LHS, const KnownBits &RHS, bool NSW=false, bool NUW=false, bool SelfAdd=false)
Compute knownbits resulting from addition of LHS and RHS.
KnownBits sext(unsigned BitWidth) const
Return known bits for a sign extension of the value we're tracking.
KnownBits zextOrTrunc(unsigned BitWidth) const
Return known bits for a zero extension or truncation of the value we're tracking.
APInt getMaxValue() const
Return the maximal unsigned value possible given these KnownBits.
static LLVM_ABI KnownBits srem(const KnownBits &LHS, const KnownBits &RHS)
Compute known bits for srem(LHS, RHS).
static LLVM_ABI KnownBits udiv(const KnownBits &LHS, const KnownBits &RHS, bool Exact=false)
Compute known bits for udiv(LHS, RHS).
bool isNegative() const
Returns true if this value is known to be negative.
static KnownBits sub(const KnownBits &LHS, const KnownBits &RHS, bool NSW=false, bool NUW=false)
Compute knownbits resulting from subtraction of LHS and RHS.
static LLVM_ABI KnownBits shl(const KnownBits &LHS, const KnownBits &RHS, bool NUW=false, bool NSW=false, bool ShAmtNonZero=false)
Compute known bits for shl(LHS, RHS).
SimplifyQuery getWithInstruction(const Instruction *I) const
APFloatBase::ExponentType minExponent