Go to the documentation of this file.
50 if (isa<ScalableVectorType>(DstTy))
56 unsigned NumElts = cast<FixedVectorType>(DstTy)->getNumElements();
57 if (NumElts != cast<FixedVectorType>(CV->
getType())->getNumElements())
69 for (
unsigned i = 0;
i != NumElts; ++
i) {
89 assert(
Op &&
Op->isCast() &&
"Can't fold cast of cast without a cast!");
94 Type *SrcTy =
Op->getOperand(0)->getType();
95 Type *MidTy =
Op->getType();
106 nullptr, FakeIntPtrTy,
nullptr);
117 if (
PointerType *DPTy = dyn_cast<PointerType>(DestTy))
118 if (PTy->getAddressSpace() == DPTy->getAddressSpace() &&
119 !PTy->isOpaque() && !DPTy->isOpaque() &&
120 PTy->getNonOpaquePointerElementType()->isSized()) {
124 IdxList.push_back(Zero);
128 IdxList.push_back(Zero);
134 PTy->getNonOpaquePointerElementType(), V, IdxList);
139 if (
VectorType *DestPTy = dyn_cast<VectorType>(DestTy)) {
141 assert(DestPTy->getPrimitiveSizeInBits() ==
143 "Not cast between same sized vectors!");
146 if (isa<ConstantAggregateZero>(V))
156 if (isa<ConstantInt>(V) || isa<ConstantFP>(V))
162 if (isa<ConstantPointerNull>(V))
190 if (
FP->getType()->isPPC_FP128Ty())
198 FP->getValueAPF().bitcastToAPInt());
215 assert(
C->getType()->isIntegerTy() &&
216 (cast<IntegerType>(
C->getType())->getBitWidth() & 7) == 0 &&
217 "Non-byte sized integer input");
218 unsigned CSize = cast<IntegerType>(
C->getType())->getBitWidth()/8;
219 assert(ByteSize &&
"Must be accessing some piece");
220 assert(ByteStart+ByteSize <= CSize &&
"Extracting invalid piece from input");
221 assert(ByteSize != CSize &&
"Should not extract everything");
225 APInt V = CI->getValue();
228 V = V.
trunc(ByteSize*8);
235 if (!CE)
return nullptr;
237 switch (CE->getOpcode()) {
238 default:
return nullptr;
239 case Instruction::Or: {
246 if (RHSC->isMinusOne())
254 case Instruction::And: {
260 if (
RHS->isNullValue())
268 case Instruction::LShr: {
269 ConstantInt *Amt = dyn_cast<ConstantInt>(CE->getOperand(1));
274 if ((ShAmt & 7) != 0)
279 if (ShAmt.
uge(CSize - ByteStart))
283 if (ShAmt.
ule(CSize - (ByteStart + ByteSize)))
291 case Instruction::Shl: {
292 ConstantInt *Amt = dyn_cast<ConstantInt>(CE->getOperand(1));
297 if ((ShAmt & 7) != 0)
302 if (ShAmt.
uge(ByteStart + ByteSize))
306 if (ShAmt.
ule(ByteStart))
314 case Instruction::ZExt: {
315 unsigned SrcBitSize =
316 cast<IntegerType>(CE->getOperand(0)->getType())->getBitWidth();
319 if (ByteStart*8 >= SrcBitSize)
324 if (ByteStart == 0 && ByteSize*8 == SrcBitSize)
325 return CE->getOperand(0);
329 if ((SrcBitSize&7) == 0 && (ByteStart+ByteSize)*8 <= SrcBitSize)
334 if ((ByteStart+ByteSize)*8 < SrcBitSize) {
335 assert((SrcBitSize&7) &&
"Shouldn't get byte sized case here");
352 if (isa<PoisonValue>(V))
355 if (isa<UndefValue>(V)) {
359 if (opc == Instruction::ZExt || opc == Instruction::SExt ||
360 opc == Instruction::UIToFP || opc == Instruction::SIToFP)
366 opc != Instruction::AddrSpaceCast)
376 }
else if (CE->getOpcode() == Instruction::GetElementPtr &&
379 opc != Instruction::AddrSpaceCast &&
382 !cast<GEPOperator>(CE)->getInRangeIndex().hasValue() &&
386 !CE->getType()->isVectorTy()) {
389 bool isAllNull =
true;
390 for (
unsigned i = 1,
e = CE->getNumOperands();
i !=
e; ++
i)
391 if (!CE->getOperand(
i)->isNullValue()) {
404 if ((isa<ConstantVector>(V) || isa<ConstantDataVector>(V)) &&
406 cast<FixedVectorType>(DestTy)->getNumElements() ==
407 cast<FixedVectorType>(V->
getType())->getNumElements()) {
408 VectorType *DestVecTy = cast<VectorType>(DestTy);
413 cast<VectorType>(DestTy)->getElementCount(),
419 e = cast<FixedVectorType>(V->
getType())->getNumElements();
433 case Instruction::FPTrunc:
434 case Instruction::FPExt:
435 if (
ConstantFP *FPC = dyn_cast<ConstantFP>(V)) {
437 APFloat Val = FPC->getValueAPF();
443 case Instruction::FPToUI:
444 case Instruction::FPToSI:
445 if (
ConstantFP *FPC = dyn_cast<ConstantFP>(V)) {
446 const APFloat &V = FPC->getValueAPF();
448 uint32_t DestBitWidth = cast<IntegerType>(DestTy)->getBitWidth();
449 APSInt IntVal(DestBitWidth, opc == Instruction::FPToUI);
459 case Instruction::IntToPtr:
463 case Instruction::PtrToInt:
469 case Instruction::UIToFP:
470 case Instruction::SIToFP:
472 const APInt &api = CI->getValue();
480 case Instruction::ZExt:
487 case Instruction::SExt:
494 case Instruction::Trunc: {
498 uint32_t DestBitWidth = cast<IntegerType>(DestTy)->getBitWidth();
501 CI->getValue().trunc(DestBitWidth));
507 if ((DestBitWidth & 7) == 0 &&
508 (cast<IntegerType>(V->
getType())->getBitWidth() & 7) == 0)
514 case Instruction::BitCast:
516 case Instruction::AddrSpaceCast:
524 if (
Cond->isNullValue())
return V2;
525 if (
Cond->isAllOnesValue())
return V1;
529 auto *V1VTy = CondV->
getType();
532 for (
unsigned i = 0,
e = V1VTy->getNumElements();
i !=
e; ++
i) {
538 auto *
Cond = cast<Constant>(CondV->getOperand(
i));
539 if (isa<PoisonValue>(
Cond)) {
541 }
else if (V1Element == V2Element) {
543 }
else if (isa<UndefValue>(
Cond)) {
544 V = isa<UndefValue>(V1Element) ? V1Element : V2Element;
546 if (!isa<ConstantInt>(
Cond))
break;
547 V =
Cond->isNullValue() ? V2Element : V1Element;
553 if (Result.size() == V1VTy->getNumElements())
557 if (isa<PoisonValue>(
Cond))
560 if (isa<UndefValue>(
Cond)) {
561 if (isa<UndefValue>(V1))
return V1;
565 if (V1 ==
V2)
return V1;
567 if (isa<PoisonValue>(V1))
569 if (isa<PoisonValue>(
V2))
575 if (isa<PoisonValue>(
C))
580 if (isa<ConstantExpr>(
C))
583 if (isa<ConstantInt>(
C) || isa<GlobalVariable>(
C) || isa<ConstantFP>(
C) ||
584 isa<ConstantPointerNull>(
C) || isa<Function>(
C))
587 if (
C->getType()->isVectorTy())
593 if (isa<UndefValue>(V1) && NotPoison(
V2))
return V2;
594 if (isa<UndefValue>(
V2) && NotPoison(V1))
return V1;
612 auto *ValVTy = cast<VectorType>(Val->
getType());
616 if (isa<PoisonValue>(Val) || isa<UndefValue>(Idx))
620 if (isa<UndefValue>(Val))
623 auto *CIdx = dyn_cast<ConstantInt>(Idx);
627 if (
auto *ValFVTy = dyn_cast<FixedVectorType>(Val->
getType())) {
629 if (CIdx->uge(ValFVTy->getNumElements()))
634 if (
auto *CE = dyn_cast<ConstantExpr>(Val)) {
635 if (
auto *
GEP = dyn_cast<GEPOperator>(CE)) {
637 Ops.
reserve(CE->getNumOperands());
638 for (
unsigned i = 0,
e = CE->getNumOperands();
i !=
e; ++
i) {
640 if (
Op->getType()->isVectorTy()) {
644 Ops.push_back(ScalarOp);
648 return CE->getWithOperands(Ops, ValVTy->getElementType(),
false,
649 GEP->getSourceElementType());
650 }
else if (CE->getOpcode() == Instruction::InsertElement) {
651 if (
const auto *IEIdx = dyn_cast<ConstantInt>(CE->getOperand(2))) {
653 APSInt(CIdx->getValue()))) {
654 return CE->getOperand(1);
666 if (CIdx->getValue().ult(ValVTy->getElementCount().getKnownMinValue())) {
677 if (isa<UndefValue>(Idx))
682 if (isa<ConstantAggregateZero>(Val) && Elt->
isNullValue())
686 if (!CIdx)
return nullptr;
690 if (isa<ScalableVectorType>(Val->
getType()))
693 auto *ValTy = cast<FixedVectorType>(Val->
getType());
695 unsigned NumElts = ValTy->getNumElements();
696 if (CIdx->
uge(NumElts))
700 Result.reserve(NumElts);
703 for (
unsigned i = 0;
i != NumElts; ++
i) {
705 Result.push_back(Elt);
718 auto *V1VTy = cast<VectorType>(V1->
getType());
719 unsigned MaskNumElts =
Mask.size();
722 Type *EltTy = V1VTy->getElementType();
731 if (
all_of(
Mask, [](
int Elt) {
return Elt == 0; })) {
739 }
else if (!MaskEltCount.isScalable())
744 if (isa<ScalableVectorType>(V1VTy))
747 unsigned SrcNumElts = V1VTy->getElementCount().getKnownMinValue();
751 for (
unsigned i = 0;
i != MaskNumElts; ++
i) {
758 if (
unsigned(Elt) >= SrcNumElts*2)
760 else if (
unsigned(Elt) >= SrcNumElts) {
769 Result.push_back(InElt);
796 NumElts =
ST->getNumElements();
798 NumElts = cast<ArrayType>(Agg->
getType())->getNumElements();
801 for (
unsigned i = 0;
i != NumElts; ++
i) {
803 if (!
C)
return nullptr;
821 bool IsScalableVector = isa<ScalableVectorType>(
C->getType());
822 bool HasScalarUndefOrScalableVectorUndef =
823 (!
C->getType()->isVectorTy() || IsScalableVector) && isa<UndefValue>(
C);
825 if (HasScalarUndefOrScalableVectorUndef) {
827 case Instruction::FNeg:
829 case Instruction::UnaryOpsEnd:
835 assert(!HasScalarUndefOrScalableVectorUndef &&
"Unexpected UndefValue");
837 assert(!isa<ConstantInt>(
C) &&
"Unexpected Integer UnaryOp");
840 const APFloat &CV = CFP->getValueAPF();
844 case Instruction::FNeg:
847 }
else if (
auto *VTy = dyn_cast<FixedVectorType>(
C->getType())) {
858 for (
unsigned i = 0,
e = VTy->getNumElements();
i !=
e; ++
i) {
890 if (isa<PoisonValue>(
C1) || isa<PoisonValue>(C2))
895 bool IsScalableVector = isa<ScalableVectorType>(
C1->getType());
896 bool HasScalarUndefOrScalableVectorUndef =
897 (!
C1->getType()->isVectorTy() || IsScalableVector) &&
898 (isa<UndefValue>(
C1) || isa<UndefValue>(C2));
899 if (HasScalarUndefOrScalableVectorUndef) {
901 case Instruction::Xor:
902 if (isa<UndefValue>(
C1) && isa<UndefValue>(C2))
908 case Instruction::Sub:
910 case Instruction::And:
911 if (isa<UndefValue>(
C1) && isa<UndefValue>(C2))
916 if (isa<UndefValue>(
C1) && isa<UndefValue>(C2))
927 case Instruction::SDiv:
928 case Instruction::UDiv:
938 case Instruction::URem:
939 case Instruction::SRem:
946 case Instruction::Or:
947 if (isa<UndefValue>(
C1) && isa<UndefValue>(C2))
950 case Instruction::LShr:
952 if (isa<UndefValue>(C2))
959 case Instruction::AShr:
961 if (isa<UndefValue>(C2))
969 case Instruction::Shl:
971 if (isa<UndefValue>(C2))
978 case Instruction::FSub:
983 case Instruction::FAdd:
984 case Instruction::FMul:
985 case Instruction::FDiv:
986 case Instruction::FRem:
988 if (isa<UndefValue>(
C1) && isa<UndefValue>(C2))
998 case Instruction::BinaryOpsEnd:
1004 assert((!HasScalarUndefOrScalableVectorUndef) &&
"Unexpected UndefValue");
1007 if (
ConstantInt *CI2 = dyn_cast<ConstantInt>(C2)) {
1010 if (CI2->isZero())
return C1;
1012 case Instruction::Sub:
1013 if (CI2->isZero())
return C1;
1016 if (CI2->isZero())
return C2;
1020 case Instruction::UDiv:
1021 case Instruction::SDiv:
1027 case Instruction::URem:
1028 case Instruction::SRem:
1034 case Instruction::And:
1035 if (CI2->isZero())
return C2;
1036 if (CI2->isMinusOne())
1041 if (CE1->getOpcode() == Instruction::ZExt) {
1042 unsigned DstWidth = CI2->getType()->getBitWidth();
1044 CE1->getOperand(0)->getType()->getPrimitiveSizeInBits();
1046 if ((PossiblySetBits & CI2->getValue()) == PossiblySetBits)
1051 if (CE1->getOpcode() == Instruction::PtrToInt &&
1052 isa<GlobalValue>(CE1->getOperand(0))) {
1053 GlobalValue *GV = cast<GlobalValue>(CE1->getOperand(0));
1070 if (isa<Function>(GV) && !
DL.getFunctionPtrAlign())
1072 }
else if (isa<Function>(GV)) {
1076 }
else if (isa<GlobalVariable>(GV)) {
1077 GVAlign = cast<GlobalVariable>(GV)->getAlign();
1080 if (GVAlign && *GVAlign > 1) {
1081 unsigned DstWidth = CI2->getType()->getBitWidth();
1082 unsigned SrcWidth =
std::min(DstWidth,
Log2(*GVAlign));
1086 if ((CI2->getValue() & BitsNotSet) == CI2->getValue())
1092 case Instruction::Or:
1093 if (CI2->isZero())
return C1;
1094 if (CI2->isMinusOne())
1097 case Instruction::Xor:
1098 if (CI2->isZero())
return C1;
1101 switch (CE1->getOpcode()) {
1103 case Instruction::ICmp:
1104 case Instruction::FCmp:
1110 CE1->getOperand(1));
1114 case Instruction::AShr:
1117 if (CE1->getOpcode() == Instruction::ZExt)
1121 }
else if (isa<ConstantInt>(
C1)) {
1128 if (
ConstantInt *CI2 = dyn_cast<ConstantInt>(C2)) {
1129 const APInt &C1V = CI1->getValue();
1130 const APInt &C2V = CI2->getValue();
1136 case Instruction::Sub:
1140 case Instruction::UDiv:
1141 assert(!CI2->isZero() &&
"Div by zero handled above");
1143 case Instruction::SDiv:
1144 assert(!CI2->isZero() &&
"Div by zero handled above");
1148 case Instruction::URem:
1149 assert(!CI2->isZero() &&
"Div by zero handled above");
1151 case Instruction::SRem:
1152 assert(!CI2->isZero() &&
"Div by zero handled above");
1156 case Instruction::And:
1158 case Instruction::Or:
1160 case Instruction::Xor:
1162 case Instruction::Shl:
1166 case Instruction::LShr:
1170 case Instruction::AShr:
1178 case Instruction::SDiv:
1179 case Instruction::UDiv:
1180 case Instruction::URem:
1181 case Instruction::SRem:
1182 case Instruction::LShr:
1183 case Instruction::AShr:
1184 case Instruction::Shl:
1185 if (CI1->isZero())
return C1;
1190 }
else if (
ConstantFP *CFP1 = dyn_cast<ConstantFP>(
C1)) {
1191 if (
ConstantFP *CFP2 = dyn_cast<ConstantFP>(C2)) {
1192 const APFloat &C1V = CFP1->getValueAPF();
1193 const APFloat &C2V = CFP2->getValueAPF();
1198 case Instruction::FAdd:
1201 case Instruction::FSub:
1204 case Instruction::FMul:
1207 case Instruction::FDiv:
1210 case Instruction::FRem:
1215 }
else if (
auto *VTy = dyn_cast<VectorType>(
C1->getType())) {
1220 if (
Constant *C1Splat =
C1->getSplatValue()) {
1222 VTy->getElementCount(),
1227 if (
auto *FVTy = dyn_cast<FixedVectorType>(VTy)) {
1231 for (
unsigned i = 0,
e = FVTy->getNumElements();
i !=
e; ++
i) {
1256 if (!isa<ConstantExpr>(
T) || cast<ConstantExpr>(
T)->
getOpcode() != Opcode)
1259 }
else if (isa<ConstantExpr>(C2)) {
1267 if (
C1->getType()->isIntegerTy(1)) {
1270 case Instruction::Sub:
1274 case Instruction::Shl:
1275 case Instruction::LShr:
1276 case Instruction::AShr:
1280 case Instruction::SDiv:
1281 case Instruction::UDiv:
1285 case Instruction::URem:
1286 case Instruction::SRem:
1312 "Cannot compare values of different types!");
1318 if (!isa<ConstantExpr>(V1)) {
1319 if (!isa<ConstantExpr>(
V2)) {
1322 R = dyn_cast<ConstantInt>(
1324 if (R && !R->isZero())
1326 R = dyn_cast<ConstantInt>(
1328 if (R && !R->isZero())
1330 R = dyn_cast<ConstantInt>(
1332 if (R && !R->isZero())
1348 case Instruction::FPTrunc:
1349 case Instruction::FPExt:
1350 case Instruction::UIToFP:
1351 case Instruction::SIToFP:
1365 auto isGlobalUnsafeForEquality = [](
const GlobalValue *GV) {
1366 if (GV->isInterposable() || GV->hasGlobalUnnamedAddr())
1368 if (
const auto *GVar = dyn_cast<GlobalVariable>(GV)) {
1369 Type *Ty = GVar->getValueType();
1381 if (!isa<GlobalAlias>(GV1) && !isa<GlobalAlias>(GV2))
1382 if (!isGlobalUnsafeForEquality(GV1) && !isGlobalUnsafeForEquality(GV2))
1402 "Cannot compare different types of values!");
1405 if (!isa<ConstantExpr>(V1) && !isa<GlobalValue>(V1) &&
1406 !isa<BlockAddress>(V1)) {
1407 if (!isa<GlobalValue>(
V2) && !isa<ConstantExpr>(
V2) &&
1408 !isa<BlockAddress>(
V2)) {
1414 if (R && !R->isZero())
1418 if (R && !R->isZero())
1422 if (R && !R->isZero())
1435 }
else if (
const GlobalValue *GV = dyn_cast<GlobalValue>(V1)) {
1436 if (isa<ConstantExpr>(
V2)) {
1449 }
else if (isa<BlockAddress>(
V2)) {
1452 assert(isa<ConstantPointerNull>(
V2) &&
"Canonicalization guarantee!");
1458 if (!GV->hasExternalWeakLinkage() && !isa<GlobalAlias>(GV) &&
1460 GV->getType()->getAddressSpace()))
1463 }
else if (
const BlockAddress *BA = dyn_cast<BlockAddress>(V1)) {
1464 if (isa<ConstantExpr>(
V2)) {
1479 if (BA2->getFunction() != BA->getFunction())
1483 assert((isa<ConstantPointerNull>(
V2) || isa<GlobalValue>(
V2)) &&
1484 "Canonicalization guarantee!");
1494 case Instruction::Trunc:
1495 case Instruction::FPTrunc:
1496 case Instruction::FPExt:
1497 case Instruction::FPToUI:
1498 case Instruction::FPToSI:
1501 case Instruction::BitCast:
1504 if (
const GlobalValue *GV = dyn_cast<GlobalValue>(CE1Op0))
1508 case Instruction::UIToFP:
1509 case Instruction::SIToFP:
1510 case Instruction::ZExt:
1511 case Instruction::SExt:
1519 if (CE1->
getOpcode() == Instruction::ZExt) isSigned =
false;
1520 if (CE1->
getOpcode() == Instruction::SExt) isSigned =
true;
1527 case Instruction::GetElementPtr: {
1531 if (isa<ConstantPointerNull>(
V2)) {
1534 if (
const GlobalValue *GV = dyn_cast<GlobalValue>(CE1Op0)) {
1537 if (!GV->hasExternalWeakLinkage() && CE1GEP->
isInBounds())
1540 }
else if (
const GlobalValue *GV2 = dyn_cast<GlobalValue>(
V2)) {
1541 if (
const GlobalValue *GV = dyn_cast<GlobalValue>(CE1Op0)) {
1548 }
else if (
const auto *CE2GEP = dyn_cast<GEPOperator>(
V2)) {
1551 const Constant *CE2Op0 = cast<Constant>(CE2GEP->getPointerOperand());
1552 if (isa<GlobalValue>(CE1Op0) && isa<GlobalValue>(CE2Op0)) {
1554 if (CE1Op0 != CE2Op0) {
1557 cast<GlobalValue>(CE2Op0));
1575 if (
VectorType *VT = dyn_cast<VectorType>(
C1->getType()))
1577 VT->getElementCount());
1589 if (isa<PoisonValue>(
C1) || isa<PoisonValue>(C2))
1592 if (isa<UndefValue>(
C1) || isa<UndefValue>(C2)) {
1602 if (isIntegerPredicate)
1611 if (
C1->isNullValue()) {
1612 if (
const GlobalValue *GV = dyn_cast<GlobalValue>(C2))
1614 if (!isa<GlobalAlias>(GV) && !GV->hasExternalWeakLinkage() &&
1616 GV->getType()->getAddressSpace())) {
1626 if (!isa<GlobalAlias>(GV) && !GV->hasExternalWeakLinkage() &&
1628 GV->getType()->getAddressSpace())) {
1647 if (
C1->getType()->isIntegerTy(1)) {
1650 if (isa<ConstantInt>(C2))
1660 if (isa<ConstantInt>(
C1) && isa<ConstantInt>(C2)) {
1661 const APInt &V1 = cast<ConstantInt>(
C1)->getValue();
1662 const APInt &
V2 = cast<ConstantInt>(C2)->getValue();
1664 }
else if (isa<ConstantFP>(
C1) && isa<ConstantFP>(C2)) {
1665 const APFloat &C1V = cast<ConstantFP>(
C1)->getValueAPF();
1666 const APFloat &C2V = cast<ConstantFP>(C2)->getValueAPF();
1668 }
else if (
auto *C1VTy = dyn_cast<VectorType>(
C1->getType())) {
1674 C1VTy->getElementCount(),
1679 if (isa<ScalableVectorType>(C1VTy))
1687 for (
unsigned I = 0,
E = C1VTy->getElementCount().getKnownMinValue();
1700 if (
C1->getType()->isFloatingPointTy() &&
1703 (isa<ConstantExpr>(
C1) || isa<ConstantExpr>(C2))) {
1867 if (CE2->getOpcode() == Instruction::BitCast &&
1877 if ((CE1->getOpcode() == Instruction::SExt &&
1879 (CE1->getOpcode() == Instruction::ZExt &&
1883 if (CE1Inverse == CE1Op0) {
1893 if ((!isa<ConstantExpr>(
C1) && isa<ConstantExpr>(C2)) ||
1906 template<
typename IndexTy>
1909 if (Idxs.
empty())
return true;
1912 if (cast<Constant>(Idxs[0])->isNullValue())
return true;
1916 if (
auto *CI = dyn_cast<ConstantInt>(Idxs[0])) {
1920 auto *CV = cast<ConstantDataVector>(Idxs[0]);
1921 CI = dyn_cast_or_null<ConstantInt>(CV->getSplatValue());
1922 if (!CI || !CI->isOne())
1926 for (
unsigned i = 1,
e = Idxs.
size();
i !=
e; ++
i)
1927 if (!cast<Constant>(Idxs[
i])->isNullValue())
1942 if (IndexVal < 0 || (NumElements > 0 && (
uint64_t)IndexVal >= NumElements))
1954 if (PointeeTy !=
GEP->getResultElementType())
1957 Constant *Idx0 = cast<Constant>(Idxs[0]);
1965 GEP->getSourceElementType(), cast<Constant>(
GEP->getPointerOperand()),
1966 NewIndices, InBounds &&
GEP->isInBounds(),
GEP->getInRangeIndex());
1984 auto *LastIdx = cast<Constant>(
GEP->getOperand(
GEP->getNumOperands()-1));
1985 Type *LastIdxTy = LastIdx->getType();
1991 NewIndices.
append(
GEP->idx_begin(),
GEP->idx_end() - 1);
1995 if (LastIdxTy != Idx0->
getType()) {
1996 unsigned CommonExtendedWidth =
1999 CommonExtendedWidth =
std::max(CommonExtendedWidth, 64U);
2014 if (IRIndex && *IRIndex ==
GEP->getNumIndices() - 1)
2018 GEP->getSourceElementType(), cast<Constant>(
GEP->getPointerOperand()),
2019 NewIndices, InBounds &&
GEP->isInBounds(), IRIndex);
2026 if (Idxs.
empty())
return C;
2031 if (isa<PoisonValue>(
C))
2034 if (isa<UndefValue>(
C))
2038 auto IsNoOp = [&]() {
2041 if (!
C->getType()->getScalarType()->isOpaquePointerTy() && Idxs.
size() != 1)
2045 Constant *IdxC = cast<Constant>(Idx);
2046 return IdxC->
isNullValue() || isa<UndefValue>(IdxC);
2050 return GEPTy->
isVectorTy() && !
C->getType()->isVectorTy()
2052 cast<VectorType>(GEPTy)->getElementCount(),
C)
2055 if (
C->isNullValue()) {
2057 for (
Value *Idx : Idxs)
2058 if (!isa<UndefValue>(Idx) && !cast<Constant>(Idx)->isNullValue()) {
2063 PointerType *PtrTy = cast<PointerType>(
C->getType()->getScalarType());
2066 assert(Ty &&
"Invalid indices for GEP!");
2069 if (
VectorType *VT = dyn_cast<VectorType>(
C->getType()))
2074 for (
Value *Idx : Idxs) {
2075 if (
auto *VT = dyn_cast<VectorType>(Idx->getType())) {
2076 assert((!isa<VectorType>(GEPTy) || isa<ScalableVectorType>(GEPTy) ==
2077 isa<ScalableVectorType>(VT)) &&
2078 "Mismatched GEPTy vector types");
2089 if (
auto *
GEP = dyn_cast<GEPOperator>(CE))
2102 Constant *Idx0 = cast<Constant>(Idxs[0]);
2105 dyn_cast<PointerType>(CE->getOperand(0)->getType());
2106 PointerType *DstPtrTy = dyn_cast<PointerType>(CE->getType());
2107 if (SrcPtrTy && DstPtrTy && !SrcPtrTy->
isOpaque() &&
2113 if (SrcArrayTy && DstArrayTy
2118 Idxs, InBounds, InRangeIndex);
2127 Type *Ty = PointeeTy;
2128 Type *Prev =
C->getType();
2131 !isa<ConstantInt>(Idxs[0]) && !isa<ConstantDataVector>(Idxs[0]);
2132 for (
unsigned i = 1,
e = Idxs.
size();
i !=
e;
2133 Prev = Ty, Ty = (++GEPIter).getIndexedType(), ++
i) {
2134 if (!isa<ConstantInt>(Idxs[
i]) && !isa<ConstantDataVector>(Idxs[
i])) {
2139 if (!isa<ConstantInt>(Idxs[
i - 1]) && !isa<ConstantDataVector>(Idxs[
i - 1]))
2142 if (InRangeIndex &&
i == *InRangeIndex + 1) {
2148 if (isa<StructType>(Ty)) {
2152 if (isa<VectorType>(Ty)) {
2157 auto *STy = cast<ArrayType>(Ty);
2158 if (
ConstantInt *CI = dyn_cast<ConstantInt>(Idxs[
i])) {
2162 if (CI->isNegative()) {
2168 auto *CV = cast<ConstantDataVector>(Idxs[
i]);
2170 for (
unsigned I = 0,
E = CV->getNumElements();
I !=
E; ++
I) {
2171 auto *CI = cast<ConstantInt>(CV->getElementAsConstant(
I));
2173 if (CI->isNegative()) {
2183 if (isa<StructType>(Prev)) {
2193 uint64_t NumElements = STy->getArrayNumElements();
2197 Constant *CurrIdx = cast<Constant>(Idxs[
i]);
2199 NewIdxs[
i - 1] ? NewIdxs[
i - 1] : cast<Constant>(Idxs[
i - 1]);
2201 bool IsPrevIdxVector = PrevIdx->getType()->isVectorTy();
2202 bool UseVector = IsCurrIdxVector || IsPrevIdxVector;
2204 if (!IsCurrIdxVector && IsPrevIdxVector)
2206 cast<FixedVectorType>(PrevIdx->getType())->getNumElements(), CurrIdx);
2208 if (!IsPrevIdxVector && IsCurrIdxVector)
2210 cast<FixedVectorType>(CurrIdx->
getType())->getNumElements(), PrevIdx);
2217 ? cast<FixedVectorType>(PrevIdx->getType())->getNumElements()
2218 : cast<FixedVectorType>(CurrIdx->
getType())->getNumElements(),
2225 unsigned CommonExtendedWidth =
2226 std::max(PrevIdx->getType()->getScalarSizeInBits(),
2228 CommonExtendedWidth =
std::max(CommonExtendedWidth, 64U);
2237 ? cast<FixedVectorType>(PrevIdx->getType())->getNumElements()
2238 : cast<FixedVectorType>(CurrIdx->
getType())->getNumElements());
2240 if (!PrevIdx->getType()->isIntOrIntVectorTy(CommonExtendedWidth))
2250 if (!NewIdxs.empty()) {
2251 for (
unsigned i = 0,
e = Idxs.
size();
i !=
e; ++
i)
2252 if (!NewIdxs[
i]) NewIdxs[
i] = cast<Constant>(Idxs[
i]);
2259 if (!Unknown && !InBounds)
2260 if (
auto *GV = dyn_cast<GlobalVariable>(
C))
2263 true, InRangeIndex);
static bool compare(const APFloat &LHS, const APFloat &RHS, FCmpInst::Predicate Pred)
Return result of LHS Pred RHS comparison.
@ FCMP_ULE
1 1 0 1 True if unordered, less than, or equal
static bool isSameValue(const APSInt &I1, const APSInt &I2)
Determine if two APSInts have the same value, zero- or sign-extending as needed.
bool isAllOnesValue() const
Return true if this is the value that would be returned by getAllOnesValue.
bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
static unsigned foldConstantCastPair(unsigned opc, ConstantExpr *Op, Type *DstTy)
This function determines which opcode to use to fold two constant cast expressions together.
bool isAssociative() const LLVM_READONLY
Return true if the instruction is associative:
Predicate getSwappedPredicate() const
For example, EQ->EQ, SLE->SGE, ULT->UGT, OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
This is an optimization pass for GlobalISel generic memory operations.
static IntegerType * getInt1Ty(LLVMContext &C)
static Constant * getExtractElement(Constant *Vec, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
Align getPointerAlignment(const DataLayout &DL) const
Returns an alignment of the pointer value.
static Constant * getNot(Constant *C)
A parsed version of the target data layout string in and methods for querying it.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
bool isX86_MMXTy() const
Return true if this is X86 MMX.
bool containsPoisonElement() const
Return true if this is a vector constant that includes any poison elements.
static bool compare(const APInt &LHS, const APInt &RHS, ICmpInst::Predicate Pred)
Return result of LHS Pred RHS comparison.
opStatus add(const APFloat &RHS, roundingMode RM)
bool ule(const APInt &RHS) const
Unsigned less or equal comparison.
static Constant * get(StructType *T, ArrayRef< Constant * > V)
static PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space.
instcombine should handle this C2 when C1
Constant * ConstantFoldSelectInstruction(Constant *Cond, Constant *V1, Constant *V2)
Attempt to constant fold a select instruction with the specified operands.
unsigned getMinSignedBits() const
NOTE: This is soft-deprecated. Please use getSignificantBits() instead.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
unsigned getOpcode() const
Return the opcode at the root of this constant expression.
const APInt & getValue() const
Return the constant as an APInt value reference.
static Constant * getSExt(Constant *C, Type *Ty, bool OnlyIfReduced=false)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
static Constant * getICmp(unsigned short pred, Constant *LHS, Constant *RHS, bool OnlyIfReduced=false)
get* - Return some common constants without having to specify the full Instruction::OPCODE identifier...
@ FCMP_ONE
0 1 1 0 True if ordered and operands are unequal
const fltSemantics & getFltSemantics() const
match_combine_or< LTy, RTy > m_CombineOr(const LTy &L, const RTy &R)
Combine two pattern matchers matching L || R.
unsigned getAddressSpace() const
Return the address space of the Pointer type.
Predicate getInversePredicate() const
For example, EQ -> NE, UGT -> ULE, SLT -> SGE, OEQ -> UNE, UGT -> OLE, OLT -> UGE,...
static Constant * getBitCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static unsigned isEliminableCastPair(Instruction::CastOps firstOpcode, Instruction::CastOps secondOpcode, Type *SrcTy, Type *MidTy, Type *DstTy, Type *SrcIntPtrTy, Type *MidIntPtrTy, Type *DstIntPtrTy)
Determine how a pair of casts can be eliminated, if they can be at all.
static Constant * getSelect(Constant *C, Constant *V1, Constant *V2, Type *OnlyIfReducedTy=nullptr)
Select constant expr.
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
opStatus divide(const APFloat &RHS, roundingMode RM)
cstfp_pred_ty< is_neg_zero_fp > m_NegZeroFP()
Match a floating-point negative zero.
@ ICMP_SGT
signed greater than
The instances of the Type class are immutable: once they are created, they are never changed.
unsigned getBitWidth() const
Return the number of bits in the APInt.
bool isEquality() const
Return true if this predicate is either EQ or NE.
Type * getElementType() const
@ ICMP_SLE
signed less or equal
static Type * getGEPReturnType(Type *ElTy, Value *Ptr, ArrayRef< Value * > IdxList)
Returns the pointer type returned by the GEP instruction, which may be a vector of pointers.
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList)
Create an "inbounds" getelementptr.
static ICmpInst::Predicate evaluateICmpRelation(Constant *V1, Constant *V2, bool isSigned)
This function determines if there is anything we can decide about the two constants provided.
static Constant * BitCastConstantVector(Constant *CV, VectorType *DstTy)
Convert the specified vector Constant node to the specified vector type.
APInt lshr(unsigned shiftAmt) const
Logical right-shift function.
Class to represent array types.
gep_type_iterator gep_type_begin(const User *GEP)
bool isFloatingPointTy() const
Return true if this is one of the six floating-point types.
static FCmpInst::Predicate evaluateFCmpRelation(Constant *V1, Constant *V2)
This function determines if there is anything we can decide about the two constants provided.
opStatus mod(const APFloat &RHS)
@ FCMP_OGT
0 0 1 0 True if ordered and greater than
Type * getNonOpaquePointerElementType() const
Only use this method in code that is not reachable with opaque pointers, or part of deprecated method...
static APInt getZero(unsigned numBits)
Get the '0' value for the specified bit-width.
static IntegerType * getInt32Ty(LLVMContext &C)
bool empty() const
empty - Check if the array is empty.
Constant * ConstantFoldExtractValueInstruction(Constant *Agg, ArrayRef< unsigned > Idxs)
Attempt to constant fold an extractvalue instruction with the specified operands and indices.
static Constant * getPointerCast(Constant *C, Type *Ty)
Create a BitCast, AddrSpaceCast, or a PtrToInt cast constant expression.
gep_type_iterator gep_type_end(const User *GEP)
constexpr int UndefMaskElem
@ FCMP_ULT
1 1 0 0 True if unordered or less than
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
apint_match m_APInt(const APInt *&Res)
Match a ConstantInt or splatted ConstantVector, binding the specified pointer to the contained APInt.
bool uge(const APInt &RHS) const
Unsigned greater or equal comparison.
This is the shared class of boolean and integer constants.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
static ElementCount get(ScalarTy MinVal, bool Scalable)
opStatus convertToInteger(MutableArrayRef< integerPart > Input, unsigned int Width, bool IsSigned, roundingMode RM, bool *IsExact) const
void lshrInPlace(unsigned ShiftAmt)
Logical right-shift this APInt by ShiftAmt in place.
bool match(Val *V, const Pattern &P)
bool isNullValue() const
Return true if this is the value that would be returned by getNullValue.
static Constant * FoldBitCast(Constant *V, Type *DestTy)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
(vector float) vec_cmpeq(*A, *B) C
@ ICMP_ULE
unsigned less or equal
unsigned Log2(Align A)
Returns the log2 of the alignment.
@ FCMP_UGE
1 0 1 1 True if unordered, greater than, or equal
static Optional< unsigned > getOpcode(ArrayRef< VPValue * > Values)
Returns the opcode of Values or ~0 if they do not all agree.
bool isVectorTy() const
True if this is an instance of VectorType.
ElementCount getElementCount() const
Return an ElementCount instance to represent the (possibly scalable) number of elements in the vector...
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Class to represent integer types.
static Constant * getAllOnesValue(Type *Ty)
@ FCMP_UNO
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
Constant * ConstantFoldGetElementPtr(Type *Ty, Constant *C, bool InBounds, Optional< unsigned > InRangeIndex, ArrayRef< Value * > Idxs)
An arbitrary precision integer that knows its signedness.
uint64_t getZExtValue() const
Get zero extended value.
ConstantFP - Floating Point Values [float, double].
static Constant * getSplat(ElementCount EC, Constant *Elt)
Return a ConstantVector with the specified constant in each element.
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
static Constant * getXor(Constant *C1, Constant *C2)
static Constant * get(Type *Ty, uint64_t V, bool IsSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
@ FCMP_OEQ
0 0 0 1 True if ordered and equal
@ FCMP_OLT
0 1 0 0 True if ordered and less than
static FixedVectorType * get(Type *ElementType, unsigned NumElts)
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
unsigned getIntegerBitWidth() const
opStatus subtract(const APFloat &RHS, roundingMode RM)
APInt srem(const APInt &RHS) const
Function for signed remainder operation.
Constant * ConstantFoldBinaryInstruction(unsigned Opcode, Constant *V1, Constant *V2)
Constant * ConstantFoldExtractElementInstruction(Constant *Val, Constant *Idx)
Attempt to constant fold an extractelement instruction with the specified operands and indices.
cst_pred_ty< is_one > m_One()
Match an integer 1 or a vector with all elements equal to 1.
bool isCommutative() const LLVM_READONLY
Return true if the instruction is commutative:
@ FCMP_FALSE
0 0 0 0 Always false (always folded)
opStatus multiply(const APFloat &RHS, roundingMode RM)
APInt ashr(unsigned ShiftAmt) const
Arithmetic right-shift function.
Constant * ConstantFoldCastInstruction(unsigned opcode, Constant *V, Type *DestTy)
bool isIntegerTy() const
True if this is an instance of IntegerType.
Base class of all SIMD vector types.
static Constant * getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced=false)
bool hasAllZeroIndices() const
Return true if all of the indices of this GEP are zeros.
static Constant * getCompare(unsigned short pred, Constant *C1, Constant *C2, bool OnlyIfReduced=false)
Return an ICmp or FCmp comparison operator constant expression.
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
is_zero m_Zero()
Match any null constant or a vector with all elements equal to 0.
Constant * ConstantFoldCompareInstruction(CmpInst::Predicate Predicate, Constant *C1, Constant *C2)
This is an important base class in LLVM.
static Constant * getBinOpIdentity(unsigned Opcode, Type *Ty, bool AllowRHSConstant=false)
Return the identity constant for a binary opcode.
APInt sdiv(const APInt &RHS) const
Signed division function for APInt.
Constant * ConstantFoldInsertValueInstruction(Constant *Agg, Constant *Val, ArrayRef< unsigned > Idxs)
ConstantFoldInsertValueInstruction - Attempt to constant fold an insertvalue instruction with the spe...
Module * getParent()
Get the module that this global value is contained inside of...
bool isIntOrPtrTy() const
Return true if this is an integer type or a pointer type.
static ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
APFloat neg(APFloat X)
Returns the negated value of the argument.
static Constant * get(unsigned Opcode, Constant *C1, unsigned Flags=0, Type *OnlyIfReducedTy=nullptr)
get - Return a unary operator constant expression, folding if possible.
static Constant * getOr(Constant *C1, Constant *C2)
Class to represent pointers.
static Constant * ExtractConstantBytes(Constant *C, unsigned ByteStart, unsigned ByteSize)
V is an integer constant which only has a subset of its bytes used.
Constant Vector Declarations.
Constant * ConstantFoldInsertElementInstruction(Constant *Val, Constant *Elt, Constant *Idx)
Attempt to constant fold an insertelement instruction with the specified operands and indices.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
@ FCMP_OGE
0 0 1 1 True if ordered and greater than or equal
static Constant * getCast(unsigned ops, Constant *C, Type *Ty, bool OnlyIfReduced=false)
Convenience function for getting a Cast operation.
@ ICMP_UGE
unsigned greater or equal
A Module instance is used to store all the information related to an LLVM module.
static Constant * getNaN(Type *Ty, bool Negative=false, uint64_t Payload=0)
APInt urem(const APInt &RHS) const
Unsigned remainder operation.
Class for arbitrary precision integers.
@ ICMP_SLT
signed less than
bool isIntPredicate() const
The address of a basic block.
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
Class to represent struct types.
SmallVector< MachineOperand, 4 > Cond
auto m_Undef()
Match an arbitrary undef constant.
static Constant * getSExtOrBitCast(Constant *C, Type *Ty)
@ ICMP_ULT
unsigned less than
static Constant * foldGEPOfGEP(GEPOperator *GEP, Type *PointeeTy, bool InBounds, ArrayRef< Value * > Idxs)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Constant * getAggregateElement(unsigned Elt) const
For aggregates (struct/array/vector) return the constant that corresponds to the specified element if...
Type * getType() const
All values are typed, get the type of this value.
LLVMContext & getContext() const
All values hold a context through their type.
bool isSequential() const
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static ICmpInst::Predicate areGlobalsPotentiallyEqual(const GlobalValue *GV1, const GlobalValue *GV2)
static Constant * get(ArrayRef< Constant * > V)
int64_t getSExtValue() const
Return the constant as a 64-bit integer value after it has been sign extended as appropriate for the ...
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
APInt udiv(const APInt &RHS) const
Unsigned division operation.
static ConstantInt * getFalse(LLVMContext &Context)
static Constant * getFCmp(unsigned short pred, Constant *LHS, Constant *RHS, bool OnlyIfReduced=false)
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
@ FCMP_UGT
1 0 1 0 True if unordered or greater than
static constexpr roundingMode rmTowardZero
static bool isIndexInRangeOfArrayType(uint64_t NumElements, const ConstantInt *CI)
Test whether a given ConstantInt is in-range for a SequentialType.
static IntegerType * getInt64Ty(LLVMContext &C)
A constant value that is initialized with an expression using other constant values.
static Constant * getSDiv(Constant *C1, Constant *C2, bool isExact=false)
static ConstantInt * getTrue(LLVMContext &Context)
APInt trunc(unsigned width) const
Truncate to new width.
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
bool isMinSignedValue() const
Determine if this is the smallest signed value.
bool isInBounds() const
Test whether this is an inbounds GEP, as defined by LangRef.html.
bool isEmptyTy() const
Return true if this type is empty, that is, it has no elements or all of its elements are empty.
static Constant * getAdd(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
static Constant * get(Type *Ty, double V)
This returns a ConstantFP, or a vector containing a splat of a ConstantFP, for the specified value in...
bool uge(uint64_t Num) const
This function will return true iff this constant represents a value with active bits bigger than 64 b...
static Type * getTypeAtIndex(Type *Ty, Value *Idx)
Return the type of the element at the given index of an indexable type.
static bool InRange(int64_t Value, unsigned short Shift, int LBound, int HBound)
constexpr unsigned BitWidth
static Constant * getAnd(Constant *C1, Constant *C2)
Constant * ConstantFoldShuffleVectorInstruction(Constant *V1, Constant *V2, ArrayRef< int > Mask)
Attempt to constant fold a shufflevector instruction with the specified operands and mask.
bool isPPC_FP128Ty() const
Return true if this is powerpc long double.
static Constant * get(ArrayType *T, ArrayRef< Constant * > V)
static Constant * getGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList, bool InBounds=false, Optional< unsigned > InRangeIndex=None, Type *OnlyIfReducedTy=nullptr)
Getelementptr form.
static Type * getIndexedType(Type *Ty, ArrayRef< Value * > IdxList)
Returns the result type of a getelementptr with the given source element type and indexes.
static Constant * getLShr(Constant *C1, Constant *C2, bool isExact=false)
@ ICMP_SGE
signed greater or equal
bool isTrueWhenEqual() const
This is just a convenience.
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
static constexpr roundingMode rmNearestTiesToEven
opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
static Constant * getSRem(Constant *C1, Constant *C2)
static bool isInBoundsIndices(ArrayRef< IndexTy > Idxs)
Test whether the given sequence of normalized indices is "inbounds".
@ ICMP_UGT
unsigned greater than
@ FCMP_UNE
1 1 1 0 True if unordered or not equal
static Constant * getSplat(unsigned NumElts, Constant *Elt)
Return a ConstantVector with the specified constant in each element.
size_t size() const
size - Get the array size.
Align max(MaybeAlign Lhs, Align Rhs)
Constant * getSplatValue(bool AllowUndefs=false) const
If all elements of the vector constant have the same value, return that value.
@ FCMP_OLE
0 1 0 1 True if ordered and less than or equal
static bool isUnordered(Predicate predicate)
Determine if the predicate is an unordered operation.
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Constructs an APInt value that has the bottom loBitsSet bits set.
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
opStatus convertFromAPInt(const APInt &Input, bool IsSigned, roundingMode RM)
APInt shl(unsigned shiftAmt) const
Left-shift function.
Value * getOperand(unsigned i) const
bool NullPointerIsDefined(const Function *F, unsigned AS=0)
Check whether null pointer dereferencing is considered undefined behavior for a given function or an ...
Constant * ConstantFoldUnaryInstruction(unsigned Opcode, Constant *V)
static ConstantAggregateZero * get(Type *Ty)
void reserve(size_type N)
@ FCMP_TRUE
1 1 1 1 Always true (always folded)
LLVM Value Representation.
static VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
Type * getElementType() const
bool isX86_AMXTy() const
Return true if this is X86 AMX.
@ FCMP_ORD
0 1 1 1 True if ordered (no nans)
bool isFirstClassType() const
Return true if the type is "first class", meaning it is a valid type for a Value.
@ FCMP_UEQ
1 0 0 1 True if unordered or equal
TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
static PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.