#include "llvm/Analysis/ValueTracking.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumeBundleQueries.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/DomConditionCache.h"
#include "llvm/Analysis/GuardUtils.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/Loads.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/VectorUtils.h"
#include "llvm/Analysis/WithCache.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/ConstantRange.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/EHPersonalities.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicsAArch64.h"
#include "llvm/IR/IntrinsicsAMDGPU.h"
#include "llvm/IR/IntrinsicsRISCV.h"
#include "llvm/IR/IntrinsicsX86.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/TargetParser/RISCVTargetParser.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <optional>
#include <utility>
usingnamespacellvm;
usingnamespacellvm::PatternMatch;
static cl::opt<unsigned> DomConditionsMaxUses("dom-conditions-max-uses",
cl::Hidden, cl::init(20));
static unsigned getBitWidth(Type *Ty, const DataLayout &DL) { … }
static const Instruction *safeCxtI(const Value *V, const Instruction *CxtI) { … }
static const Instruction *safeCxtI(const Value *V1, const Value *V2, const Instruction *CxtI) { … }
static bool getShuffleDemandedElts(const ShuffleVectorInst *Shuf,
const APInt &DemandedElts,
APInt &DemandedLHS, APInt &DemandedRHS) { … }
static void computeKnownBits(const Value *V, const APInt &DemandedElts,
KnownBits &Known, unsigned Depth,
const SimplifyQuery &Q);
void llvm::computeKnownBits(const Value *V, KnownBits &Known, unsigned Depth,
const SimplifyQuery &Q) { … }
void llvm::computeKnownBits(const Value *V, KnownBits &Known,
const DataLayout &DL, unsigned Depth,
AssumptionCache *AC, const Instruction *CxtI,
const DominatorTree *DT, bool UseInstrInfo) { … }
KnownBits llvm::computeKnownBits(const Value *V, const DataLayout &DL,
unsigned Depth, AssumptionCache *AC,
const Instruction *CxtI,
const DominatorTree *DT, bool UseInstrInfo) { … }
KnownBits llvm::computeKnownBits(const Value *V, const APInt &DemandedElts,
const DataLayout &DL, unsigned Depth,
AssumptionCache *AC, const Instruction *CxtI,
const DominatorTree *DT, bool UseInstrInfo) { … }
static bool haveNoCommonBitsSetSpecialCases(const Value *LHS, const Value *RHS,
const SimplifyQuery &SQ) { … }
bool llvm::haveNoCommonBitsSet(const WithCache<const Value *> &LHSCache,
const WithCache<const Value *> &RHSCache,
const SimplifyQuery &SQ) { … }
bool llvm::isOnlyUsedInZeroComparison(const Instruction *I) { … }
bool llvm::isOnlyUsedInZeroEqualityComparison(const Instruction *I) { … }
bool llvm::isKnownToBeAPowerOfTwo(const Value *V, const DataLayout &DL,
bool OrZero, unsigned Depth,
AssumptionCache *AC, const Instruction *CxtI,
const DominatorTree *DT, bool UseInstrInfo) { … }
static bool isKnownNonZero(const Value *V, const APInt &DemandedElts,
const SimplifyQuery &Q, unsigned Depth);
bool llvm::isKnownNonNegative(const Value *V, const SimplifyQuery &SQ,
unsigned Depth) { … }
bool llvm::isKnownPositive(const Value *V, const SimplifyQuery &SQ,
unsigned Depth) { … }
bool llvm::isKnownNegative(const Value *V, const SimplifyQuery &SQ,
unsigned Depth) { … }
static bool isKnownNonEqual(const Value *V1, const Value *V2,
const APInt &DemandedElts, unsigned Depth,
const SimplifyQuery &Q);
bool llvm::isKnownNonEqual(const Value *V1, const Value *V2,
const DataLayout &DL, AssumptionCache *AC,
const Instruction *CxtI, const DominatorTree *DT,
bool UseInstrInfo) { … }
bool llvm::MaskedValueIsZero(const Value *V, const APInt &Mask,
const SimplifyQuery &SQ, unsigned Depth) { … }
static unsigned ComputeNumSignBits(const Value *V, const APInt &DemandedElts,
unsigned Depth, const SimplifyQuery &Q);
static unsigned ComputeNumSignBits(const Value *V, unsigned Depth,
const SimplifyQuery &Q) { … }
unsigned llvm::ComputeNumSignBits(const Value *V, const DataLayout &DL,
unsigned Depth, AssumptionCache *AC,
const Instruction *CxtI,
const DominatorTree *DT, bool UseInstrInfo) { … }
unsigned llvm::ComputeMaxSignificantBits(const Value *V, const DataLayout &DL,
unsigned Depth, AssumptionCache *AC,
const Instruction *CxtI,
const DominatorTree *DT) { … }
static void computeKnownBitsAddSub(bool Add, const Value *Op0, const Value *Op1,
bool NSW, bool NUW,
const APInt &DemandedElts,
KnownBits &KnownOut, KnownBits &Known2,
unsigned Depth, const SimplifyQuery &Q) { … }
static void computeKnownBitsMul(const Value *Op0, const Value *Op1, bool NSW,
bool NUW, const APInt &DemandedElts,
KnownBits &Known, KnownBits &Known2,
unsigned Depth, const SimplifyQuery &Q) { … }
void llvm::computeKnownBitsFromRangeMetadata(const MDNode &Ranges,
KnownBits &Known) { … }
static bool isEphemeralValueOf(const Instruction *I, const Value *E) { … }
bool llvm::isAssumeLikeIntrinsic(const Instruction *I) { … }
bool llvm::isValidAssumeForContext(const Instruction *Inv,
const Instruction *CxtI,
const DominatorTree *DT,
bool AllowEphemerals) { … }
static bool cmpExcludesZero(CmpInst::Predicate Pred, const Value *RHS) { … }
static bool isKnownNonZeroFromAssume(const Value *V, const SimplifyQuery &Q) { … }
static void computeKnownBitsFromCmp(const Value *V, CmpInst::Predicate Pred,
Value *LHS, Value *RHS, KnownBits &Known,
const SimplifyQuery &Q) { … }
static void computeKnownBitsFromICmpCond(const Value *V, ICmpInst *Cmp,
KnownBits &Known,
const SimplifyQuery &SQ, bool Invert) { … }
static void computeKnownBitsFromCond(const Value *V, Value *Cond,
KnownBits &Known, unsigned Depth,
const SimplifyQuery &SQ, bool Invert) { … }
void llvm::computeKnownBitsFromContext(const Value *V, KnownBits &Known,
unsigned Depth, const SimplifyQuery &Q) { … }
static void computeKnownBitsFromShiftOperator(
const Operator *I, const APInt &DemandedElts, KnownBits &Known,
KnownBits &Known2, unsigned Depth, const SimplifyQuery &Q,
function_ref<KnownBits(const KnownBits &, const KnownBits &, bool)> KF) { … }
static KnownBits
getKnownBitsFromAndXorOr(const Operator *I, const APInt &DemandedElts,
const KnownBits &KnownLHS, const KnownBits &KnownRHS,
unsigned Depth, const SimplifyQuery &Q) { … }
static KnownBits computeKnownBitsForHorizontalOperation(
const Operator *I, const APInt &DemandedElts, unsigned Depth,
const SimplifyQuery &Q,
const function_ref<KnownBits(const KnownBits &, const KnownBits &)>
KnownBitsFunc) { … }
KnownBits llvm::analyzeKnownBitsFromAndXorOr(const Operator *I,
const KnownBits &KnownLHS,
const KnownBits &KnownRHS,
unsigned Depth,
const SimplifyQuery &SQ) { … }
ConstantRange llvm::getVScaleRange(const Function *F, unsigned BitWidth) { … }
void llvm::adjustKnownBitsForSelectArm(KnownBits &Known, Value *Cond,
Value *Arm, bool Invert, unsigned Depth,
const SimplifyQuery &Q) { … }
static void computeKnownBitsFromOperator(const Operator *I,
const APInt &DemandedElts,
KnownBits &Known, unsigned Depth,
const SimplifyQuery &Q) { … }
KnownBits llvm::computeKnownBits(const Value *V, const APInt &DemandedElts,
unsigned Depth, const SimplifyQuery &Q) { … }
KnownBits llvm::computeKnownBits(const Value *V, unsigned Depth,
const SimplifyQuery &Q) { … }
void computeKnownBits(const Value *V, const APInt &DemandedElts,
KnownBits &Known, unsigned Depth,
const SimplifyQuery &Q) { … }
static bool isPowerOfTwoRecurrence(const PHINode *PN, bool OrZero,
unsigned Depth, SimplifyQuery &Q) { … }
static bool isImpliedToBeAPowerOfTwoFromCond(const Value *V, bool OrZero,
const Value *Cond,
bool CondIsTrue) { … }
bool llvm::isKnownToBeAPowerOfTwo(const Value *V, bool OrZero, unsigned Depth,
const SimplifyQuery &Q) { … }
static bool isGEPKnownNonNull(const GEPOperator *GEP, unsigned Depth,
const SimplifyQuery &Q) { … }
static bool isKnownNonNullFromDominatingCondition(const Value *V,
const Instruction *CtxI,
const DominatorTree *DT) { … }
static bool rangeMetadataExcludesValue(const MDNode* Ranges, const APInt& Value) { … }
static bool isNonZeroRecurrence(const PHINode *PN) { … }
static bool matchOpWithOpEqZero(Value *Op0, Value *Op1) { … }
static bool isNonZeroAdd(const APInt &DemandedElts, unsigned Depth,
const SimplifyQuery &Q, unsigned BitWidth, Value *X,
Value *Y, bool NSW, bool NUW) { … }
static bool isNonZeroSub(const APInt &DemandedElts, unsigned Depth,
const SimplifyQuery &Q, unsigned BitWidth, Value *X,
Value *Y) { … }
static bool isNonZeroMul(const APInt &DemandedElts, unsigned Depth,
const SimplifyQuery &Q, unsigned BitWidth, Value *X,
Value *Y, bool NSW, bool NUW) { … }
static bool isNonZeroShift(const Operator *I, const APInt &DemandedElts,
unsigned Depth, const SimplifyQuery &Q,
const KnownBits &KnownVal) { … }
static bool isKnownNonZeroFromOperator(const Operator *I,
const APInt &DemandedElts,
unsigned Depth, const SimplifyQuery &Q) { … }
bool isKnownNonZero(const Value *V, const APInt &DemandedElts,
const SimplifyQuery &Q, unsigned Depth) { … }
bool llvm::isKnownNonZero(const Value *V, const SimplifyQuery &Q,
unsigned Depth) { … }
static std::optional<std::pair<Value*, Value*>>
getInvertibleOperands(const Operator *Op1,
const Operator *Op2) { … }
static bool isModifyingBinopOfNonZero(const Value *V1, const Value *V2,
const APInt &DemandedElts, unsigned Depth,
const SimplifyQuery &Q) { … }
static bool isNonEqualMul(const Value *V1, const Value *V2,
const APInt &DemandedElts, unsigned Depth,
const SimplifyQuery &Q) { … }
static bool isNonEqualShl(const Value *V1, const Value *V2,
const APInt &DemandedElts, unsigned Depth,
const SimplifyQuery &Q) { … }
static bool isNonEqualPHIs(const PHINode *PN1, const PHINode *PN2,
const APInt &DemandedElts, unsigned Depth,
const SimplifyQuery &Q) { … }
static bool isNonEqualSelect(const Value *V1, const Value *V2,
const APInt &DemandedElts, unsigned Depth,
const SimplifyQuery &Q) { … }
static bool isNonEqualPointersWithRecursiveGEP(const Value *A, const Value *B,
const SimplifyQuery &Q) { … }
static bool isKnownNonEqual(const Value *V1, const Value *V2,
const APInt &DemandedElts, unsigned Depth,
const SimplifyQuery &Q) { … }
static bool isSignedMinMaxClamp(const Value *Select, const Value *&In,
const APInt *&CLow, const APInt *&CHigh) { … }
static bool isSignedMinMaxIntrinsicClamp(const IntrinsicInst *II,
const APInt *&CLow,
const APInt *&CHigh) { … }
static unsigned computeNumSignBitsVectorConstant(const Value *V,
const APInt &DemandedElts,
unsigned TyBits) { … }
static unsigned ComputeNumSignBitsImpl(const Value *V,
const APInt &DemandedElts,
unsigned Depth, const SimplifyQuery &Q);
static unsigned ComputeNumSignBits(const Value *V, const APInt &DemandedElts,
unsigned Depth, const SimplifyQuery &Q) { … }
static unsigned ComputeNumSignBitsImpl(const Value *V,
const APInt &DemandedElts,
unsigned Depth, const SimplifyQuery &Q) { … }
Intrinsic::ID llvm::getIntrinsicForCallSite(const CallBase &CB,
const TargetLibraryInfo *TLI) { … }
static bool inputDenormalIsIEEE(const Function &F, const Type *Ty) { … }
static bool inputDenormalIsIEEEOrPosZero(const Function &F, const Type *Ty) { … }
static bool outputDenormalIsIEEEOrPosZero(const Function &F, const Type *Ty) { … }
bool KnownFPClass::isKnownNeverLogicalZero(const Function &F, Type *Ty) const { … }
bool KnownFPClass::isKnownNeverLogicalNegZero(const Function &F,
Type *Ty) const { … }
bool KnownFPClass::isKnownNeverLogicalPosZero(const Function &F,
Type *Ty) const { … }
void KnownFPClass::propagateDenormal(const KnownFPClass &Src, const Function &F,
Type *Ty) { … }
void KnownFPClass::propagateCanonicalizingSrc(const KnownFPClass &Src,
const Function &F, Type *Ty) { … }
bool llvm::isSignBitCheck(ICmpInst::Predicate Pred, const APInt &RHS,
bool &TrueIfSigned) { … }
std::pair<Value *, FPClassTest> llvm::fcmpToClassTest(FCmpInst::Predicate Pred,
const Function &F,
Value *LHS, Value *RHS,
bool LookThroughSrc) { … }
std::pair<Value *, FPClassTest>
llvm::fcmpToClassTest(FCmpInst::Predicate Pred, const Function &F, Value *LHS,
const APFloat *ConstRHS, bool LookThroughSrc) { … }
static std::tuple<Value *, FPClassTest, FPClassTest> exactClass(Value *V,
FPClassTest M) { … }
std::tuple<Value *, FPClassTest, FPClassTest>
llvm::fcmpImpliesClass(CmpInst::Predicate Pred, const Function &F, Value *LHS,
FPClassTest RHSClass, bool LookThroughSrc) { … }
std::tuple<Value *, FPClassTest, FPClassTest>
llvm::fcmpImpliesClass(CmpInst::Predicate Pred, const Function &F, Value *LHS,
const APFloat &ConstRHS, bool LookThroughSrc) { … }
std::tuple<Value *, FPClassTest, FPClassTest>
llvm::fcmpImpliesClass(CmpInst::Predicate Pred, const Function &F, Value *LHS,
Value *RHS, bool LookThroughSrc) { … }
static void computeKnownFPClassFromCond(const Value *V, Value *Cond,
bool CondIsTrue,
const Instruction *CxtI,
KnownFPClass &KnownFromContext) { … }
static KnownFPClass computeKnownFPClassFromContext(const Value *V,
const SimplifyQuery &Q) { … }
void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
FPClassTest InterestedClasses, KnownFPClass &Known,
unsigned Depth, const SimplifyQuery &Q);
static void computeKnownFPClass(const Value *V, KnownFPClass &Known,
FPClassTest InterestedClasses, unsigned Depth,
const SimplifyQuery &Q) { … }
static void computeKnownFPClassForFPTrunc(const Operator *Op,
const APInt &DemandedElts,
FPClassTest InterestedClasses,
KnownFPClass &Known, unsigned Depth,
const SimplifyQuery &Q) { … }
void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
FPClassTest InterestedClasses, KnownFPClass &Known,
unsigned Depth, const SimplifyQuery &Q) { … }
KnownFPClass llvm::computeKnownFPClass(const Value *V,
const APInt &DemandedElts,
FPClassTest InterestedClasses,
unsigned Depth,
const SimplifyQuery &SQ) { … }
KnownFPClass llvm::computeKnownFPClass(const Value *V,
FPClassTest InterestedClasses,
unsigned Depth,
const SimplifyQuery &SQ) { … }
Value *llvm::isBytewiseValue(Value *V, const DataLayout &DL) { … }
static Value *BuildSubAggregate(Value *From, Value *To, Type *IndexedType,
SmallVectorImpl<unsigned> &Idxs,
unsigned IdxSkip,
BasicBlock::iterator InsertBefore) { … }
static Value *BuildSubAggregate(Value *From, ArrayRef<unsigned> idx_range,
BasicBlock::iterator InsertBefore) { … }
Value *
llvm::FindInsertedValue(Value *V, ArrayRef<unsigned> idx_range,
std::optional<BasicBlock::iterator> InsertBefore) { … }
bool llvm::isGEPBasedOnPointerToString(const GEPOperator *GEP,
unsigned CharSize) { … }
bool llvm::getConstantDataArrayInfo(const Value *V,
ConstantDataArraySlice &Slice,
unsigned ElementSize, uint64_t Offset) { … }
bool llvm::getConstantStringInfo(const Value *V, StringRef &Str,
bool TrimAtNul) { … }
static uint64_t GetStringLengthH(const Value *V,
SmallPtrSetImpl<const PHINode*> &PHIs,
unsigned CharSize) { … }
uint64_t llvm::GetStringLength(const Value *V, unsigned CharSize) { … }
const Value *
llvm::getArgumentAliasingToReturnedPointer(const CallBase *Call,
bool MustPreserveNullness) { … }
bool llvm::isIntrinsicReturningPointerAliasingArgumentWithoutCapturing(
const CallBase *Call, bool MustPreserveNullness) { … }
static bool isSameUnderlyingObjectInLoop(const PHINode *PN,
const LoopInfo *LI) { … }
const Value *llvm::getUnderlyingObject(const Value *V, unsigned MaxLookup) { … }
void llvm::getUnderlyingObjects(const Value *V,
SmallVectorImpl<const Value *> &Objects,
const LoopInfo *LI, unsigned MaxLookup) { … }
const Value *llvm::getUnderlyingObjectAggressive(const Value *V) { … }
static const Value *getUnderlyingObjectFromInt(const Value *V) { … }
bool llvm::getUnderlyingObjectsForCodeGen(const Value *V,
SmallVectorImpl<Value *> &Objects) { … }
AllocaInst *llvm::findAllocaForValue(Value *V, bool OffsetZero) { … }
static bool onlyUsedByLifetimeMarkersOrDroppableInstsHelper(
const Value *V, bool AllowLifetime, bool AllowDroppable) { … }
bool llvm::onlyUsedByLifetimeMarkers(const Value *V) { … }
bool llvm::onlyUsedByLifetimeMarkersOrDroppableInsts(const Value *V) { … }
bool llvm::isSafeToSpeculativelyExecute(const Instruction *Inst,
const Instruction *CtxI,
AssumptionCache *AC,
const DominatorTree *DT,
const TargetLibraryInfo *TLI,
bool UseVariableInfo) { … }
bool llvm::isSafeToSpeculativelyExecuteWithOpcode(
unsigned Opcode, const Instruction *Inst, const Instruction *CtxI,
AssumptionCache *AC, const DominatorTree *DT, const TargetLibraryInfo *TLI,
bool UseVariableInfo) { … }
bool llvm::mayHaveNonDefUseDependency(const Instruction &I) { … }
static OverflowResult mapOverflowResult(ConstantRange::OverflowResult OR) { … }
ConstantRange
llvm::computeConstantRangeIncludingKnownBits(const WithCache<const Value *> &V,
bool ForSigned,
const SimplifyQuery &SQ) { … }
OverflowResult llvm::computeOverflowForUnsignedMul(const Value *LHS,
const Value *RHS,
const SimplifyQuery &SQ,
bool IsNSW) { … }
OverflowResult llvm::computeOverflowForSignedMul(const Value *LHS,
const Value *RHS,
const SimplifyQuery &SQ) { … }
OverflowResult
llvm::computeOverflowForUnsignedAdd(const WithCache<const Value *> &LHS,
const WithCache<const Value *> &RHS,
const SimplifyQuery &SQ) { … }
static OverflowResult
computeOverflowForSignedAdd(const WithCache<const Value *> &LHS,
const WithCache<const Value *> &RHS,
const AddOperator *Add, const SimplifyQuery &SQ) { … }
OverflowResult llvm::computeOverflowForUnsignedSub(const Value *LHS,
const Value *RHS,
const SimplifyQuery &SQ) { … }
OverflowResult llvm::computeOverflowForSignedSub(const Value *LHS,
const Value *RHS,
const SimplifyQuery &SQ) { … }
bool llvm::isOverflowIntrinsicNoWrap(const WithOverflowInst *WO,
const DominatorTree &DT) { … }
static bool shiftAmountKnownInRange(const Value *ShiftAmount) { … }
enum class UndefPoisonKind { … };
static bool includesPoison(UndefPoisonKind Kind) { … }
static bool includesUndef(UndefPoisonKind Kind) { … }
static bool canCreateUndefOrPoison(const Operator *Op, UndefPoisonKind Kind,
bool ConsiderFlagsAndMetadata) { … }
bool llvm::canCreateUndefOrPoison(const Operator *Op,
bool ConsiderFlagsAndMetadata) { … }
bool llvm::canCreatePoison(const Operator *Op, bool ConsiderFlagsAndMetadata) { … }
static bool directlyImpliesPoison(const Value *ValAssumedPoison, const Value *V,
unsigned Depth) { … }
static bool impliesPoison(const Value *ValAssumedPoison, const Value *V,
unsigned Depth) { … }
bool llvm::impliesPoison(const Value *ValAssumedPoison, const Value *V) { … }
static bool programUndefinedIfUndefOrPoison(const Value *V, bool PoisonOnly);
static bool isGuaranteedNotToBeUndefOrPoison(
const Value *V, AssumptionCache *AC, const Instruction *CtxI,
const DominatorTree *DT, unsigned Depth, UndefPoisonKind Kind) { … }
bool llvm::isGuaranteedNotToBeUndefOrPoison(const Value *V, AssumptionCache *AC,
const Instruction *CtxI,
const DominatorTree *DT,
unsigned Depth) { … }
bool llvm::isGuaranteedNotToBePoison(const Value *V, AssumptionCache *AC,
const Instruction *CtxI,
const DominatorTree *DT, unsigned Depth) { … }
bool llvm::isGuaranteedNotToBeUndef(const Value *V, AssumptionCache *AC,
const Instruction *CtxI,
const DominatorTree *DT, unsigned Depth) { … }
bool llvm::mustExecuteUBIfPoisonOnPathTo(Instruction *Root,
Instruction *OnPathTo,
DominatorTree *DT) { … }
OverflowResult llvm::computeOverflowForSignedAdd(const AddOperator *Add,
const SimplifyQuery &SQ) { … }
OverflowResult
llvm::computeOverflowForSignedAdd(const WithCache<const Value *> &LHS,
const WithCache<const Value *> &RHS,
const SimplifyQuery &SQ) { … }
bool llvm::isGuaranteedToTransferExecutionToSuccessor(const Instruction *I) { … }
bool llvm::isGuaranteedToTransferExecutionToSuccessor(const BasicBlock *BB) { … }
bool llvm::isGuaranteedToTransferExecutionToSuccessor(
BasicBlock::const_iterator Begin, BasicBlock::const_iterator End,
unsigned ScanLimit) { … }
bool llvm::isGuaranteedToTransferExecutionToSuccessor(
iterator_range<BasicBlock::const_iterator> Range, unsigned ScanLimit) { … }
bool llvm::isGuaranteedToExecuteForEveryIteration(const Instruction *I,
const Loop *L) { … }
bool llvm::propagatesPoison(const Use &PoisonOp) { … }
template <typename CallableT>
static bool handleGuaranteedWellDefinedOps(const Instruction *I,
const CallableT &Handle) { … }
void llvm::getGuaranteedWellDefinedOps(
const Instruction *I, SmallVectorImpl<const Value *> &Operands) { … }
template <typename CallableT>
static bool handleGuaranteedNonPoisonOps(const Instruction *I,
const CallableT &Handle) { … }
void llvm::getGuaranteedNonPoisonOps(const Instruction *I,
SmallVectorImpl<const Value *> &Operands) { … }
bool llvm::mustTriggerUB(const Instruction *I,
const SmallPtrSetImpl<const Value *> &KnownPoison) { … }
static bool programUndefinedIfUndefOrPoison(const Value *V,
bool PoisonOnly) { … }
bool llvm::programUndefinedIfUndefOrPoison(const Instruction *Inst) { … }
bool llvm::programUndefinedIfPoison(const Instruction *Inst) { … }
static bool isKnownNonNaN(const Value *V, FastMathFlags FMF) { … }
static bool isKnownNonZero(const Value *V) { … }
static SelectPatternResult matchFastFloatClamp(CmpInst::Predicate Pred,
Value *CmpLHS, Value *CmpRHS,
Value *TrueVal, Value *FalseVal,
Value *&LHS, Value *&RHS) { … }
static SelectPatternResult matchClamp(CmpInst::Predicate Pred,
Value *CmpLHS, Value *CmpRHS,
Value *TrueVal, Value *FalseVal) { … }
static SelectPatternResult matchMinMaxOfMinMax(CmpInst::Predicate Pred,
Value *CmpLHS, Value *CmpRHS,
Value *TVal, Value *FVal,
unsigned Depth) { … }
static Value *getNotValue(Value *V) { … }
static SelectPatternResult matchMinMax(CmpInst::Predicate Pred,
Value *CmpLHS, Value *CmpRHS,
Value *TrueVal, Value *FalseVal,
Value *&LHS, Value *&RHS,
unsigned Depth) { … }
bool llvm::isKnownNegation(const Value *X, const Value *Y, bool NeedNSW,
bool AllowPoison) { … }
bool llvm::isKnownInversion(const Value *X, const Value *Y) { … }
static SelectPatternResult matchSelectPattern(CmpInst::Predicate Pred,
FastMathFlags FMF,
Value *CmpLHS, Value *CmpRHS,
Value *TrueVal, Value *FalseVal,
Value *&LHS, Value *&RHS,
unsigned Depth) { … }
static Value *lookThroughCast(CmpInst *CmpI, Value *V1, Value *V2,
Instruction::CastOps *CastOp) { … }
SelectPatternResult llvm::matchSelectPattern(Value *V, Value *&LHS, Value *&RHS,
Instruction::CastOps *CastOp,
unsigned Depth) { … }
SelectPatternResult llvm::matchDecomposedSelectPattern(
CmpInst *CmpI, Value *TrueVal, Value *FalseVal, Value *&LHS, Value *&RHS,
Instruction::CastOps *CastOp, unsigned Depth) { … }
CmpInst::Predicate llvm::getMinMaxPred(SelectPatternFlavor SPF, bool Ordered) { … }
SelectPatternFlavor llvm::getInverseMinMaxFlavor(SelectPatternFlavor SPF) { … }
Intrinsic::ID llvm::getInverseMinMaxIntrinsic(Intrinsic::ID MinMaxID) { … }
APInt llvm::getMinMaxLimit(SelectPatternFlavor SPF, unsigned BitWidth) { … }
std::pair<Intrinsic::ID, bool>
llvm::canConvertToMinOrMaxIntrinsic(ArrayRef<Value *> VL) { … }
bool llvm::matchSimpleRecurrence(const PHINode *P, BinaryOperator *&BO,
Value *&Start, Value *&Step) { … }
bool llvm::matchSimpleRecurrence(const BinaryOperator *I, PHINode *&P,
Value *&Start, Value *&Step) { … }
static bool isTruePredicate(CmpInst::Predicate Pred, const Value *LHS,
const Value *RHS) { … }
static std::optional<bool>
isImpliedCondOperands(CmpInst::Predicate Pred, const Value *ALHS,
const Value *ARHS, const Value *BLHS, const Value *BRHS) { … }
static std::optional<bool>
isImpliedCondMatchingOperands(CmpInst::Predicate LPred,
CmpInst::Predicate RPred) { … }
static std::optional<bool> isImpliedCondCommonOperandWithCR(
CmpInst::Predicate LPred, const ConstantRange &LCR,
CmpInst::Predicate RPred, const ConstantRange &RCR) { … }
static std::optional<bool> isImpliedCondICmps(const ICmpInst *LHS,
CmpInst::Predicate RPred,
const Value *R0, const Value *R1,
const DataLayout &DL,
bool LHSIsTrue) { … }
static std::optional<bool>
isImpliedCondAndOr(const Instruction *LHS, CmpInst::Predicate RHSPred,
const Value *RHSOp0, const Value *RHSOp1,
const DataLayout &DL, bool LHSIsTrue, unsigned Depth) { … }
std::optional<bool>
llvm::isImpliedCondition(const Value *LHS, CmpInst::Predicate RHSPred,
const Value *RHSOp0, const Value *RHSOp1,
const DataLayout &DL, bool LHSIsTrue, unsigned Depth) { … }
std::optional<bool> llvm::isImpliedCondition(const Value *LHS, const Value *RHS,
const DataLayout &DL,
bool LHSIsTrue, unsigned Depth) { … }
static std::pair<Value *, bool>
getDomPredecessorCondition(const Instruction *ContextI) { … }
std::optional<bool> llvm::isImpliedByDomCondition(const Value *Cond,
const Instruction *ContextI,
const DataLayout &DL) { … }
std::optional<bool> llvm::isImpliedByDomCondition(CmpInst::Predicate Pred,
const Value *LHS,
const Value *RHS,
const Instruction *ContextI,
const DataLayout &DL) { … }
static void setLimitsForBinOp(const BinaryOperator &BO, APInt &Lower,
APInt &Upper, const InstrInfoQuery &IIQ,
bool PreferSignedRange) { … }
static ConstantRange getRangeForIntrinsic(const IntrinsicInst &II) { … }
static ConstantRange getRangeForSelectPattern(const SelectInst &SI,
const InstrInfoQuery &IIQ) { … }
static void setLimitForFPToI(const Instruction *I, APInt &Lower, APInt &Upper) { … }
ConstantRange llvm::computeConstantRange(const Value *V, bool ForSigned,
bool UseInstrInfo, AssumptionCache *AC,
const Instruction *CtxI,
const DominatorTree *DT,
unsigned Depth) { … }
static void
addValueAffectedByCondition(Value *V,
function_ref<void(Value *)> InsertAffected) { … }
void llvm::findValuesAffectedByCondition(
Value *Cond, bool IsAssume, function_ref<void(Value *)> InsertAffected) { … }