25#define DEBUG_TYPE "instcombine"
31 SQ.getWithInstruction(&Inst));
43 bool IsCanonicalizing =
false) {
51 if (Ty->isAggregateType())
55 if (Mask ==
fcNan && IsCanonicalizing)
94 Known.knownNot(~DemandedMask);
146 if (InferredFMF != FMF) {
147 FPOp->dropUBImplyingAttrsAndMetadata();
148 FPOp->setFastMathFlags(InferredFMF);
176 Known.knownNot(~DemandedMask);
188 if ((DemandedMask & ~NegOrZero) ==
fcNone &&
192 if ((DemandedMask & ~PosOrZero) ==
fcNone &&
212 bool OrderedZeroSign = !NSZ;
216 case Intrinsic::maximum: {
235 case Intrinsic::minimum: {
254 case Intrinsic::maxnum:
255 case Intrinsic::maximumnum: {
273 case Intrinsic::minnum:
274 case Intrinsic::minimumnum: {
299 Known.knownNot(~DemandedMask);
310 const fltSemantics &DstTy =
I.getType()->getScalarType()->getFltSemantics();
312 I.getOperand(0)->getType()->getScalarType()->getFltSemantics();
321 if (DemandedMask &
fcNan)
322 SrcDemandedMask |=
fcNan;
336 const bool SubnormalNeverProducesNormal =
341 if (!SubnormalNeverProducesNormal) {
350 const bool PosOverflowIsNeverPosInf =
352 const bool NegOverflowIsNeverNegInf =
355 if ((DemandedMask &
fcPosInf) && !PosOverflowIsNeverPosInf)
357 if ((DemandedMask &
fcNegInf) && !NegOverflowIsNeverNegInf)
377 Known.knownNot(~DemandedMask);
391 Type *VTy =
I->getType();
395 FMF =
FPOp->getFastMathFlags();
399 switch (
I->getOpcode()) {
400 case Instruction::FNeg: {
403 Value *FNegSrc =
I->getOperand(0);
418 Known, FNegFAbsSrc, ThisDemandedMask, KnownSrc, IsNSZ))
442 Known.knownNot(~DemandedMask);
445 case Instruction::FAdd:
446 case Instruction::FSub: {
450 if (
I->getOperand(0) ==
I->getOperand(1) &&
451 I->getOpcode() == Instruction::FAdd &&
458 if (DemandedMask &
fcNan)
459 SrcDemandedMask |=
fcNan;
472 if (Mode.inputsMayBePositiveZero() || Mode.outputsMayBePositiveZero())
497 if (DemandedMask &
fcNan)
500 if (DemandedMask &
fcInf)
501 SrcDemandedMask |=
fcInf;
512 Known =
I->getOpcode() == Instruction::FAdd
519 Known.knownNot(~DemandedMask);
526 bool ResultNotNan = (DemandedMask &
fcNan) ==
fcNone;
529 if (ResultNotNan &&
I->getOpcode() == Instruction::FAdd &&
531 return I->getOperand(1);
537 return I->getOperand(0);
540 FMF,
Known.getKnownFPClasses(), {KnownLHS, KnownRHS});
541 if (InferredFMF != FMF) {
542 I->setFastMathFlags(InferredFMF);
548 case Instruction::FMul: {
557 if (DemandedMask &
fcInf) {
563 if (DemandedMask &
fcNan) {
577 if (DemandedMask &
fcZero)
589 Known.knownNot(~DemandedMask);
624 bool NonNanResult = (DemandedMask &
fcNan) ==
fcNone;
707 Known.knownNot(~DemandedMask);
714 FMF,
Known.getKnownFPClasses(), {KnownLHS, KnownRHS});
715 if (InferredFMF != FMF) {
716 I->setFastMathFlags(InferredFMF);
722 case Instruction::FDiv: {
738 Value *IsInfOrZeroOrNan =
Builder.CreateOr(IsInfOrNan, IsZeroOrNan);
740 return Builder.CreateSelectFMFWithUnknownProfile(
761 if (DemandedMask &
fcNan) {
772 if (DemandedMask &
fcZero)
779 if (DemandedMask &
fcZero) {
781 "should not have to worry about daz here");
782 LHSDemandedMask |=
fcZero;
783 RHSDemandedMask |=
fcInf;
790 if (DemandedMask &
fcInf) {
801 bool ResultNotNan = (DemandedMask &
fcNan) ==
fcNone;
802 bool ResultNotInf = (DemandedMask &
fcInf) ==
fcNone;
807 bool CanIgnoreZeroByZeroNan =
816 CanIgnoreZeroByZeroNan) {
848 Known.knownNot(~DemandedMask);
855 FMF,
Known.getKnownFPClasses(), {KnownLHS, KnownRHS});
856 if (InferredFMF != FMF) {
857 I->setFastMathFlags(InferredFMF);
863 case Instruction::FPTrunc:
867 case Instruction::FPExt: {
870 I->getOperand(0)->getType()->getScalarType()->getFltSemantics();
876 if (DemandedMask &
fcNan)
877 SrcDemandedMask |=
fcNan;
903 Known.knownNot(~DemandedMask);
908 case Instruction::Call: {
912 case Intrinsic::fabs: {
924 case Intrinsic::arithmetic_fence:
928 case Intrinsic::copysign: {
936 if ((DemandedMask &
fcNegative) == DemandedMask &&
939 CI->
setOperand(1, ConstantFP::get(VTy, -1.0));
943 if ((DemandedMask &
fcPositive) == DemandedMask &&
976 CI->
setOperand(1, ConstantFP::get(VTy, -1.0));
981 Known.knownNot(~DemandedMask);
985 case Intrinsic::fmuladd: {
991 if (DemandedMask &
fcNan)
992 SrcDemandedMask |=
fcNan;
996 const bool IsFMA = IID == Intrinsic::fma;
1008 KnownSrc[1] = KnownSrc[0];
1014 for (
int OpIdx = 0; OpIdx != 3; ++OpIdx) {
1016 KnownSrc[OpIdx],
SQ,
Depth + 1))
1030 case Intrinsic::maximum:
1031 case Intrinsic::minimum:
1032 case Intrinsic::maximumnum:
1033 case Intrinsic::minimumnum:
1034 case Intrinsic::maxnum:
1035 case Intrinsic::minnum: {
1036 const bool PropagateNaN =
1037 IID == Intrinsic::maximum || IID == Intrinsic::minimum;
1043 PropagateNaN && ((DemandedMask &
fcNan) ==
fcNone)
1044 ? DemandedMask | ~
fcNan
1075 bool ResultNotLogical0 = (ValidResults & ZeroMask) ==
fcNone;
1084 ((PropagateNaN && (ValidResults &
fcNan) ==
fcNone) ||
1090 if (InferredFMF != FMF) {
1097 case Intrinsic::exp:
1098 case Intrinsic::exp2:
1099 case Intrinsic::exp10: {
1145 return ConstantFP::get(VTy, 1.0);
1162 ConstantFP::get(VTy, 1.0), FMF);
1177 Value *ZeroOrInf =
Builder.CreateSelectFMFWithUnknownProfile(
1183 Known.knownNot(~DemandedMask);
1188 case Intrinsic::log:
1189 case Intrinsic::log2:
1190 case Intrinsic::log10: {
1195 if (DemandedMask &
fcNan)
1196 DemandedSrcMask |=
fcNan;
1210 if (DemandedMask &
fcNan)
1215 DemandedSrcMask |=
fcZero;
1218 if (Mode.inputsMayBeZero())
1226 if (DemandedMask &
fcZero)
1235 Known.knownNot(~DemandedMask);
1240 case Intrinsic::sqrt: {
1246 if (DemandedMask &
fcSNan)
1247 DemandedSrcMask |=
fcSNan;
1248 if (DemandedMask &
fcQNan)
1259 if (Mode.inputsMayBeZero())
1261 if (Mode.inputsMayBePositiveZero())
1274 KnownSrc.
knownNot(~DemandedSrcMask);
1284 Known.knownNot(~DemandedMask);
1303 case Intrinsic::ldexp: {
1309 if (DemandedMask &
fcNan)
1310 SrcDemandedMask |=
fcNan;
1326 if (Mode.inputsMayBePositiveZero())
1328 if (Mode.outputsMayBePositiveZero())
1343 Known.knownNot(~DemandedMask);
1348 case Intrinsic::trunc:
1349 case Intrinsic::floor:
1350 case Intrinsic::ceil:
1351 case Intrinsic::rint:
1352 case Intrinsic::nearbyint:
1353 case Intrinsic::round:
1354 case Intrinsic::roundeven: {
1359 if (DemandedMask &
fcNan)
1360 DemandedSrcMask |=
fcNan;
1364 if (IsMultiUnitFPType) {
1365 if (IID != Intrinsic::trunc && IID != Intrinsic::floor &&
1368 if (IID != Intrinsic::trunc && IID != Intrinsic::ceil &&
1379 if (Mode.inputsMayBePositiveZero())
1398 bool IsRoundNearestOrTrunc =
1399 IID == Intrinsic::round || IID == Intrinsic::roundeven ||
1400 IID == Intrinsic::nearbyint || IID == Intrinsic::rint ||
1401 IID == Intrinsic::trunc;
1403 if ((IID == Intrinsic::floor || IsRoundNearestOrTrunc) &&
1407 if ((IID == Intrinsic::ceil || IsRoundNearestOrTrunc) &&
1409 !Mode.inputsMayBePositiveZero())
1413 !Mode.inputsMayBeZero())
1414 return ConstantFP::get(VTy, -1.0);
1417 !Mode.inputsMayBeZero())
1418 return ConstantFP::get(VTy, 1.0);
1421 case Intrinsic::trunc:
1424 case Intrinsic::floor:
1427 case Intrinsic::ceil:
1436 Known.knownNot(~DemandedMask);
1443 if ((IID == Intrinsic::trunc || IsRoundNearestOrTrunc) &&
1445 (!Mode.inputsMayBePositiveZero() ||
1458 if (InferredFMF != FMF) {
1466 case Intrinsic::fptrunc_round: {
1473 case Intrinsic::canonicalize: {
1485 SrcDemandedMask |=
fcSNan;
1491 if (Mode.inputsMayBePositiveZero() ||
1492 Mode.outputsMayBePositiveZero())
1518 Known.knownNot(~DemandedMask);
1535 if (InferredFMF != FMF) {
1548 Known.knownNot(~DemandedMask);
1554 case Instruction::Select: {
1561 return I->getOperand(2);
1563 return I->getOperand(1);
1570 Known.knownNot(~DemandedMask);
1573 case Instruction::ExtractElement: {
1577 Known.knownNot(~DemandedMask);
1580 case Instruction::InsertElement: {
1588 Known = KnownVec | KnownInserted;
1589 Known.knownNot(~DemandedMask);
1592 case Instruction::ShuffleVector: {
1600 Known = KnownLHS | KnownRHS;
1601 Known.knownNot(~DemandedMask);
1604 case Instruction::InsertValue: {
1610 Known = KnownAgg | KnownElt;
1613 case Instruction::ExtractValue: {
1619 case Intrinsic::frexp: {
1622 if (DemandedMask &
fcNan)
1623 SrcDemandedMask |=
fcNan;
1653 Known.setKnownFPClasses(
Known.getKnownFPClasses() & DemandedMask);
1662 return II->getArgOperand(0);
1678 case Instruction::PHI: {
1680 if (
Depth >= PhiRecursionLimit)
1688 for (
unsigned I = 0, E =
P->getNumIncomingValues();
I != E; ++
I) {
1698 P,
P->getOperandNumForIncomingValue(
I), DemandedMask, KnownSrc,
1701 P->setIncomingValueForBlock(PredBB,
P->getIncomingValue(
I));
1716 Known.knownNot(~DemandedMask);
1721 Known.knownNot(~DemandedMask);
1736 FMF =
FPOp->getFastMathFlags();
1740 switch (
I->getOpcode()) {
1741 case Instruction::Select: {
1747 return I->getOperand(1);
1752 return I->getOperand(2);
1759 Known.knownNot(~DemandedMask);
1762 case Instruction::FNeg: {
1766 Value *FNegSrc =
I->getOperand(0);
1781 Known, Src, ThisDemandedMask, KnownSrc,
false))
1785 case Instruction::Call: {
1789 case Intrinsic::fabs: {
1802 case Intrinsic::copysign: {
1814 Mag, DemandedMask, KnownMag,
false))
1832 case Intrinsic::maxnum:
1833 case Intrinsic::minnum:
1834 case Intrinsic::maximum:
1835 case Intrinsic::minimum:
1836 case Intrinsic::maximumnum:
1837 case Intrinsic::minimumnum: {
1848 KnownLHS, KnownRHS,
F,
1859 Known.knownNot(~DemandedMask);
1871 Use &U =
I->getOperandUse(OpNo);
1873 Type *VTy = V->getType();
1875 if (DemandedMask ==
fcNone) {
1887 Known.knownNot(~DemandedMask);
1903 if (!FoldedToConst || FoldedToConst == V)
1911 Known.knownNot(~DemandedMask);
1931 if (NewVal == V && U.get() != V)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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 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 Value * simplifyDemandedFPClassMinMax(KnownFPClass &Known, Intrinsic::ID IID, const CallInst *CI, FPClassTest DemandedMask, KnownFPClass KnownLHS, KnownFPClass KnownRHS, const Function &F, bool NSZ)
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")))
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
static APFloat getOne(const fltSemantics &Sem, bool Negative=false)
Factory for Positive and Negative One.
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.
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.
@ 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 an important base class in LLVM.
static LLVM_ABI Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
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.
bool SimplifyDemandedInstructionFPClass(Instruction &Inst)
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.
Value * SimplifyMultipleUseDemandedFPClass(Instruction *I, FPClassTest DemandedMask, KnownFPClass &Known, const SimplifyQuery &Q, unsigned Depth)
Helper routine of SimplifyDemandedUseFPClass.
bool SimplifyDemandedFPClass(Instruction *I, unsigned Op, FPClassTest DemandedMask, KnownFPClass &Known, const SimplifyQuery &Q, unsigned Depth=0)
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.
Instruction * replaceOperand(Instruction &I, unsigned OpNum, Value *V)
Replace operand of instruction and add old operand to the worklist.
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 void setFastMathFlags(FastMathFlags FMF)
Convenience function for setting multiple fast-math flags on this instruction, which must be an opera...
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.
static LLVM_ABI PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
The instances of the Type class are immutable: once they are created, they are never changed.
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
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.
LLVM_ABI void takeName(Value *V)
Transfer the name from V to this value.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
OneUse_match< SubPat > m_OneUse(const SubPat &SP)
bool match(Val *V, const Pattern &P)
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_FAbs(const Opnd0 &Op0)
This is an optimization pass for GlobalISel generic memory operations.
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.
@ Known
Known to have no common set bits.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
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 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
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...
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
LLVM_ABI FPClassTest unknown_sign(FPClassTest Mask)
Return the test mask which returns true if the value could have the same set of classes,...
RoundingMode
Rounding mode.
@ TowardZero
roundTowardZero.
@ NearestTiesToEven
roundTiesToEven.
@ TowardPositive
roundTowardPositive.
@ TowardNegative
roundTowardNegative.
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...
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()
SimplifyQuery getWithInstruction(const Instruction *I) const
APFloatBase::ExponentType minExponent