LLVM 18.0.0git
|
#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/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/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 <algorithm>
#include <cassert>
#include <cstdint>
#include <optional>
#include <utility>
Go to the source code of this file.
Functions | |
static unsigned | getBitWidth (Type *Ty, const DataLayout &DL) |
Returns the bitwidth of the given scalar or pointer type. | |
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) |
Determine which bits of V are known to be either zero or one and return them in the Known bit set. | |
static void | computeKnownBits (const Value *V, KnownBits &Known, unsigned Depth, const SimplifyQuery &Q) |
static KnownBits | computeKnownBits (const Value *V, const APInt &DemandedElts, unsigned Depth, const SimplifyQuery &Q) |
Determine which bits of V are known to be either zero or one and return them. | |
static KnownBits | computeKnownBits (const Value *V, unsigned Depth, const SimplifyQuery &Q) |
Determine which bits of V are known to be either zero or one and return them. | |
static bool | isKnownToBeAPowerOfTwo (const Value *V, bool OrZero, unsigned Depth, const SimplifyQuery &Q) |
Return true if the given value is known to have exactly one bit set when defined. | |
static bool | isKnownNonZero (const Value *V, const APInt &DemandedElts, unsigned Depth, const SimplifyQuery &Q) |
Return true if the given value is known to be non-zero when defined. | |
static bool | isKnownNonZero (const Value *V, unsigned Depth, const SimplifyQuery &Q) |
static bool | isKnownNonEqual (const Value *V1, const Value *V2, unsigned Depth, const SimplifyQuery &Q) |
Return true if it is known that V1 != V2. | |
static bool | MaskedValueIsZero (const Value *V, const APInt &Mask, unsigned Depth, const SimplifyQuery &Q) |
Return true if 'V & Mask' is known to be zero. | |
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) |
static void | computeKnownBitsAddSub (bool Add, const Value *Op0, const Value *Op1, bool NSW, const APInt &DemandedElts, KnownBits &KnownOut, KnownBits &Known2, unsigned Depth, const SimplifyQuery &Q) |
static void | computeKnownBitsMul (const Value *Op0, const Value *Op1, bool NSW, const APInt &DemandedElts, KnownBits &Known, KnownBits &Known2, unsigned Depth, const SimplifyQuery &Q) |
static bool | isEphemeralValueOf (const Instruction *I, const Value *E) |
static bool | cmpExcludesZero (CmpInst::Predicate Pred, const Value *RHS) |
static bool | isKnownNonZeroFromAssume (const Value *V, const SimplifyQuery &Q) |
static void | computeKnownBitsFromCmp (const Value *V, const ICmpInst *Cmp, 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) |
Compute known bits from a shift operator, including those with a non-constant shift amount. | |
static KnownBits | getKnownBitsFromAndXorOr (const Operator *I, const APInt &DemandedElts, const KnownBits &KnownLHS, const KnownBits &KnownRHS, unsigned Depth, const SimplifyQuery &Q) |
static void | computeKnownBitsFromOperator (const Operator *I, const APInt &DemandedElts, KnownBits &Known, unsigned Depth, const SimplifyQuery &Q) |
static bool | isPowerOfTwoRecurrence (const PHINode *PN, bool OrZero, unsigned Depth, SimplifyQuery &Q) |
Try to detect a recurrence that the value of the induction variable is always a power of two (or zero). | |
static bool | isGEPKnownNonNull (const GEPOperator *GEP, unsigned Depth, const SimplifyQuery &Q) |
Test whether a GEP's result is known to be non-null. | |
static bool | isKnownNonNullFromDominatingCondition (const Value *V, const Instruction *CtxI, const DominatorTree *DT) |
static bool | rangeMetadataExcludesValue (const MDNode *Ranges, const APInt &Value) |
Does the 'Range' metadata (which must be a valid MD_range operand list) ensure that the value it's attached to is never Value? 'RangeType' is is the type of the value described by the range. | |
static bool | isNonZeroRecurrence (const PHINode *PN) |
Try to detect a recurrence that monotonically increases/decreases from a non-zero starting value. | |
static bool | isNonZeroAdd (const APInt &DemandedElts, unsigned Depth, const SimplifyQuery &Q, unsigned BitWidth, Value *X, Value *Y, bool NSW) |
static bool | isNonZeroSub (const APInt &DemandedElts, unsigned Depth, const SimplifyQuery &Q, unsigned BitWidth, Value *X, Value *Y) |
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) |
static std::optional< std::pair< Value *, Value * > > | getInvertibleOperands (const Operator *Op1, const Operator *Op2) |
If the pair of operators are the same invertible function, return the the operands of the function corresponding to each input. | |
static bool | isAddOfNonZero (const Value *V1, const Value *V2, unsigned Depth, const SimplifyQuery &Q) |
Return true if V2 == V1 + X, where X is known non-zero. | |
static bool | isNonEqualMul (const Value *V1, const Value *V2, unsigned Depth, const SimplifyQuery &Q) |
Return true if V2 == V1 * C, where V1 is known non-zero, C is not 0/1 and the multiplication is nuw or nsw. | |
static bool | isNonEqualShl (const Value *V1, const Value *V2, unsigned Depth, const SimplifyQuery &Q) |
Return true if V2 == V1 << C, where V1 is known non-zero, C is not 0 and the shift is nuw or nsw. | |
static bool | isNonEqualPHIs (const PHINode *PN1, const PHINode *PN2, 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) |
For vector constants, loop over the elements and find the constant with the minimum number of sign bits. | |
static unsigned | ComputeNumSignBitsImpl (const Value *V, const APInt &DemandedElts, unsigned Depth, const SimplifyQuery &Q) |
Return the number of times the sign bit of the register is replicated into the other bits. | |
static bool | cannotBeOrderedLessThanZeroImpl (const Value *V, const DataLayout &DL, const TargetLibraryInfo *TLI, bool SignBitOnly, unsigned Depth) |
Deprecated, use computeKnownFPClass instead. | |
static bool | inputDenormalIsIEEE (const Function &F, const Type *Ty) |
Return true if it's possible to assume IEEE treatment of input denormals in F for Val . | |
static bool | inputDenormalIsIEEEOrPosZero (const Function &F, const Type *Ty) |
static bool | outputDenormalIsIEEEOrPosZero (const Function &F, const Type *Ty) |
static FPClassTest | computeKnownFPClassFromAssumes (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) |
static Value * | BuildSubAggregate (Value *From, Value *To, Type *IndexedType, SmallVectorImpl< unsigned > &Idxs, unsigned IdxSkip, Instruction *InsertBefore) |
static Value * | BuildSubAggregate (Value *From, ArrayRef< unsigned > idx_range, Instruction *InsertBefore) |
static uint64_t | GetStringLengthH (const Value *V, SmallPtrSetImpl< const PHINode * > &PHIs, unsigned CharSize) |
If we can compute the length of the string pointed to by the specified pointer, return 'len+1'. | |
static bool | isSameUnderlyingObjectInLoop (const PHINode *PN, const LoopInfo *LI) |
PN defines a loop-variant pointer to an object. | |
static const Value * | getUnderlyingObjectFromInt (const Value *V) |
This is the function that does the work of looking through basic ptrtoint+arithmetic+inttoptr sequences. | |
static bool | onlyUsedByLifetimeMarkersOrDroppableInstsHelper (const Value *V, bool AllowLifetime, bool AllowDroppable) |
static OverflowResult | mapOverflowResult (ConstantRange::OverflowResult OR) |
Convert ConstantRange OverflowResult into ValueTracking OverflowResult. | |
static ConstantRange | computeConstantRangeIncludingKnownBits (const Value *V, bool ForSigned, const DataLayout &DL, AssumptionCache *AC, const Instruction *CxtI, const DominatorTree *DT, bool UseInstrInfo=true) |
Combine constant ranges from computeConstantRange() and computeKnownBits(). | |
static OverflowResult | computeOverflowForSignedAdd (const Value *LHS, const Value *RHS, const AddOperator *Add, const DataLayout &DL, AssumptionCache *AC, const Instruction *CxtI, const DominatorTree *DT) |
static bool | shiftAmountKnownInRange (const Value *ShiftAmount) |
Shifts return poison if shiftwidth is larger than the bitwidth. | |
static bool | canCreateUndefOrPoison (const Operator *Op, bool PoisonOnly, bool ConsiderFlagsAndMetadata) |
static bool | directlyImpliesPoison (const Value *ValAssumedPoison, const Value *V, unsigned Depth) |
static bool | impliesPoison (const Value *ValAssumedPoison, const Value *V, unsigned Depth) |
static bool | programUndefinedIfUndefOrPoison (const Value *V, bool PoisonOnly) |
static bool | isGuaranteedNotToBeUndefOrPoison (const Value *V, AssumptionCache *AC, const Instruction *CtxI, const DominatorTree *DT, unsigned Depth, bool PoisonOnly) |
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) |
Match clamp pattern for float types without care about NaNs or signed zeros. | |
static SelectPatternResult | matchClamp (CmpInst::Predicate Pred, Value *CmpLHS, Value *CmpRHS, Value *TrueVal, Value *FalseVal) |
Recognize variations of: CLAMP(v,l,h) ==> ((v) < (l) ? (l) : ((v) > (h) ? (h) : (v))) | |
static SelectPatternResult | matchMinMaxOfMinMax (CmpInst::Predicate Pred, Value *CmpLHS, Value *CmpRHS, Value *TVal, Value *FVal, unsigned Depth) |
Recognize variations of: a < c ? min(a,b) : min(b,c) ==> min(min(a,b),min(b,c)) | |
static Value * | getNotValue (Value *V) |
If the input value is the result of a 'not' op, constant integer, or vector splat of a constant integer, return the bitwise-not source value. | |
static SelectPatternResult | matchMinMax (CmpInst::Predicate Pred, Value *CmpLHS, Value *CmpRHS, Value *TrueVal, Value *FalseVal, Value *&LHS, Value *&RHS, unsigned Depth) |
Match non-obvious integer minimum and maximum sequences. | |
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) |
Helps to match a select pattern in case of a type mismatch. | |
static bool | isTruePredicate (CmpInst::Predicate Pred, const Value *LHS, const Value *RHS, const DataLayout &DL, unsigned Depth) |
Return true if "icmp Pred LHS RHS" is always true. | |
static std::optional< bool > | isImpliedCondOperands (CmpInst::Predicate Pred, const Value *ALHS, const Value *ARHS, const Value *BLHS, const Value *BRHS, const DataLayout &DL, unsigned Depth) |
Return true if "icmp Pred BLHS BRHS" is true whenever "icmp Pred
ALHS ARHS" is true. | |
static bool | areMatchingOperands (const Value *L0, const Value *L1, const Value *R0, const Value *R1, bool &AreSwappedOps) |
Return true if the operands of two compares (expanded as "L0 pred L1" and "R0 pred R1") match. | |
static std::optional< bool > | isImpliedCondMatchingOperands (CmpInst::Predicate LPred, CmpInst::Predicate RPred, bool AreSwappedOps) |
Return true if "icmp1 LPred X, Y" implies "icmp2 RPred X, Y" is true. | |
static std::optional< bool > | isImpliedCondCommonOperandWithConstants (CmpInst::Predicate LPred, const APInt &LC, CmpInst::Predicate RPred, const APInt &RC) |
Return true if "icmp LPred X, LC" implies "icmp RPred X, RC" is true. | |
static std::optional< bool > | isImpliedCondICmps (const ICmpInst *LHS, CmpInst::Predicate RPred, const Value *R0, const Value *R1, const DataLayout &DL, bool LHSIsTrue, unsigned Depth) |
Return true if LHS implies RHS (expanded to its components as "R0 RPred R1") is true. | |
static std::optional< bool > | isImpliedCondAndOr (const Instruction *LHS, CmpInst::Predicate RHSPred, const Value *RHSOp0, const Value *RHSOp1, const DataLayout &DL, bool LHSIsTrue, unsigned Depth) |
Return true if LHS implies RHS is true. | |
static std::pair< Value *, bool > | getDomPredecessorCondition (const Instruction *ContextI) |
static void | setLimitsForBinOp (const BinaryOperator &BO, APInt &Lower, APInt &Upper, const InstrInfoQuery &IIQ, bool PreferSignedRange) |
static ConstantRange | getRangeForIntrinsic (const IntrinsicInst &II) |
static void | setLimitsForSelectPattern (const SelectInst &SI, APInt &Lower, APInt &Upper, const InstrInfoQuery &IIQ) |
static void | setLimitForFPToI (const Instruction *I, APInt &Lower, APInt &Upper) |
Variables | |
static cl::opt< unsigned > | DomConditionsMaxUses ("dom-conditions-max-uses", cl::Hidden, cl::init(20)) |
|
static |
Return true if the operands of two compares (expanded as "L0 pred L1" and "R0 pred R1") match.
IsSwappedOps is true when the operands match, but are swapped.
Definition at line 8226 of file ValueTracking.cpp.
Referenced by isImpliedCondICmps().
|
static |
Definition at line 5470 of file ValueTracking.cpp.
References assert(), llvm::ArrayRef< T >::begin(), BuildSubAggregate(), llvm::ArrayRef< T >::end(), From, llvm::PoisonValue::get(), llvm::ExtractValueInst::getIndexedType(), and llvm::SmallVectorBase< Size_T >::size().
|
static |
Definition at line 5411 of file ValueTracking.cpp.
References BuildSubAggregate(), llvm::InsertValueInst::Create(), llvm::Instruction::eraseFromParent(), llvm::FindInsertedValue(), From, llvm::InsertValueInst::getAggregateOperand(), llvm::StructType::getElementType(), llvm::StructType::getNumElements(), llvm::SmallVectorTemplateBase< T, bool >::pop_back(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by BuildSubAggregate(), and llvm::FindInsertedValue().
|
static |
Definition at line 6543 of file ValueTracking.cpp.
References Idx, llvm::is_contained(), llvm::Instruction::isBinaryOp(), llvm::PoisonMaskElem, and shiftAmountKnownInRange().
|
static |
Deprecated, use computeKnownFPClass instead.
If SignBitOnly
is true, test for a known 0 sign bit rather than a standard ordered compare. e.g. make -0.0 olt 0.0 be true because of the sign bit despite comparing equal.
Definition at line 3717 of file ValueTracking.cpp.
References llvm::CallingConv::C, llvm::cannotBeNegativeZero(), cannotBeOrderedLessThanZeroImpl(), llvm::Depth, DL, llvm::Exponent, llvm::getIntrinsicForCallSite(), llvm::APFloat::getZero(), I, llvm::isKnownNeverNaN(), llvm::PatternMatch::m_APFloat(), llvm::PatternMatch::match(), and llvm::MaxAnalysisRecursionDepth.
Referenced by cannotBeOrderedLessThanZeroImpl(), and llvm::SignBitMustBeZero().
|
static |
Definition at line 565 of file ValueTracking.cpp.
References llvm::CallingConv::C, llvm::ConstantRange::contains(), llvm::APInt::getZero(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_Zero(), llvm::ConstantRange::makeExactICmpRegion(), llvm::PatternMatch::match(), and RHS.
Referenced by isKnownNonNullFromDominatingCondition(), isKnownNonZeroFromAssume(), and isKnownNonZeroFromOperator().
|
static |
Combine constant ranges from computeConstantRange() and computeKnownBits().
Definition at line 6253 of file ValueTracking.cpp.
References llvm::computeConstantRange(), llvm::computeKnownBits(), DL, llvm::ConstantRange::fromKnownBits(), llvm::ConstantRange::intersectWith(), llvm::ConstantRange::Signed, and llvm::ConstantRange::Unsigned.
Referenced by computeOverflowForSignedAdd(), llvm::computeOverflowForSignedSub(), llvm::computeOverflowForUnsignedAdd(), and llvm::computeOverflowForUnsignedSub().
|
static |
Determine which bits of V are known to be either zero or one and return them in the Known bit set.
NOTE: we cannot consider 'undef' to be "IsZero" here. The problem is that we cannot optimize based on the assumption that it is zero without changing it to be an explicit zero. If we don't change it to zero, other code could optimized based on the contradictory assumption that it is non-zero. Because instcombine aggressively folds operations with undef args anyway, this won't lose us code quality.
This function is defined on values with integer type, values with pointer type, and vectors of integers. In the case where V is a vector, known zero, and known one values are the same width as the vector element, and the bit is set only if it is true for all of the demanded elements in the vector specified by DemandedElts.
Definition at line 1812 of file ValueTracking.cpp.
References assert(), llvm::BitWidth, llvm::CallingConv::C, computeKnownBits(), llvm::computeKnownBitsFromAssume(), computeKnownBitsFromOperator(), llvm::Depth, llvm::SimplifyQuery::DL, llvm::Constant::getAggregateElement(), llvm::APInt::getBitWidth(), llvm::KnownBits::getBitWidth(), llvm::DataLayout::getPointerTypeSizeInBits(), llvm::Type::getScalarType(), llvm::DataLayout::getTypeSizeInBits(), I, llvm::Type::isIntOrIntVectorTy(), llvm::Type::isPointerTy(), llvm::Type::isPtrOrPtrVectorTy(), llvm::Log2(), llvm::PatternMatch::m_APInt(), llvm::KnownBits::makeConstant(), llvm::PatternMatch::match(), llvm::MaxAnalysisRecursionDepth, llvm::KnownBits::One, llvm::KnownBits::resetAll(), llvm::APInt::setAllBits(), llvm::KnownBits::setAllZero(), llvm::APInt::setLowBits(), and llvm::KnownBits::Zero.
Referenced by llvm::computeKnownBits(), computeKnownBits(), computeKnownBitsAddSub(), computeKnownBitsFromCmp(), computeKnownBitsFromOperator(), computeKnownBitsFromShiftOperator(), computeKnownBitsMul(), ComputeNumSignBitsImpl(), getKnownBitsFromAndXorOr(), llvm::haveNoCommonBitsSet(), llvm::isKnownNegative(), isKnownNonEqual(), llvm::isKnownNonNegative(), isKnownNonZeroFromOperator(), isKnownToBeAPowerOfTwo(), isNonZeroAdd(), isNonZeroShift(), isNonZeroSub(), and MaskedValueIsZero().
|
static |
Determine which bits of V are known to be either zero or one and return them.
Definition at line 1781 of file ValueTracking.cpp.
References computeKnownBits(), llvm::Depth, llvm::SimplifyQuery::DL, and getBitWidth().
|
static |
Definition at line 151 of file ValueTracking.cpp.
References computeKnownBits(), llvm::Depth, and llvm::APInt::getAllOnes().
Determine which bits of V are known to be either zero or one and return them.
Definition at line 1790 of file ValueTracking.cpp.
References computeKnownBits(), llvm::Depth, llvm::SimplifyQuery::DL, and getBitWidth().
|
static |
Definition at line 377 of file ValueTracking.cpp.
References llvm::Add, llvm::KnownBits::computeForAddSub(), computeKnownBits(), llvm::Depth, and llvm::KnownBits::isUnknown().
Referenced by computeKnownBitsFromOperator().
|
static |
Definition at line 626 of file ValueTracking.cpp.
References A, llvm::SimplifyQuery::AC, B, llvm::BitWidth, llvm::CallingConv::C, computeKnownBits(), llvm::Depth, llvm::SimplifyQuery::DL, llvm::ConstantRange::fromKnownBits(), llvm::KnownBits::getBitWidth(), llvm::APInt::lshrInPlace(), llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_c_And(), llvm::PatternMatch::m_c_ICmp(), llvm::PatternMatch::m_c_Or(), llvm::PatternMatch::m_c_Xor(), llvm::PatternMatch::m_CombineOr(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_ICmp(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_Power2(), llvm::PatternMatch::m_PtrToIntSameSize(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Shr(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Zero(), llvm::ConstantRange::makeAllowedICmpRegion(), llvm::PatternMatch::match(), llvm::Offset, llvm::KnownBits::One, llvm::ConstantRange::sub(), llvm::ConstantRange::toKnownBits(), llvm::KnownBits::unionWith(), and llvm::KnownBits::Zero.
Referenced by llvm::computeKnownBitsFromAssume().
|
static |
Definition at line 984 of file ValueTracking.cpp.
References llvm::KnownBits::abs(), llvm::SimplifyQuery::AC, llvm::KnownBits::anyextOrTrunc(), llvm::KnownBits::ashr(), assert(), llvm::bit_width(), llvm::BitWidth, llvm::APInt::byteSwap(), llvm::CallingConv::C, llvm::APInt::clearBit(), llvm::KnownBits::computeForAddSub(), computeKnownBits(), computeKnownBitsAddSub(), llvm::computeKnownBitsFromRangeMetadata(), computeKnownBitsFromShiftOperator(), computeKnownBitsMul(), llvm::KnownBits::countMaxLeadingZeros(), llvm::KnownBits::countMaxPopulation(), llvm::KnownBits::countMaxTrailingZeros(), llvm::KnownBits::countMinLeadingOnes(), llvm::KnownBits::countMinLeadingZeros(), llvm::KnownBits::countMinTrailingZeros(), llvm::countr_zero(), llvm::SimplifyQuery::CxtI, llvm::Depth, llvm::SimplifyQuery::DL, llvm::SimplifyQuery::DT, llvm::SelectPatternResult::Flavor, llvm::gep_type_begin(), getAlign(), llvm::APInt::getAllOnes(), llvm::APInt::getBitWidth(), llvm::KnownBits::getBitWidth(), llvm::KnownBits::getConstant(), llvm::StructLayout::getElementOffset(), llvm::generic_gep_type_iterator< ItTy >::getIndexedType(), llvm::ExtractValueInst::getIndices(), llvm::CmpInst::getInversePredicate(), getKnownBitsFromAndXorOr(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::getKnownMinValue(), llvm::InstrInfoQuery::getMetadata(), llvm::ExtractValueInst::getNumIndices(), llvm::APInt::getOneBitSet(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::DataLayout::getPointerTypeSizeInBits(), llvm::Type::getScalarType(), getShuffleDemandedElts(), llvm::Constant::getSplatValue(), llvm::DataLayout::getStructLayout(), llvm::generic_gep_type_iterator< ItTy >::getStructTypeOrNull(), llvm::ConstantInt::getTrue(), llvm::Value::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::DataLayout::getTypeSizeInBits(), llvm::getVScaleRange(), llvm::APInt::getZero(), llvm::KnownBits::hasConflict(), llvm::InstrInfoQuery::hasNoSignedWrap(), llvm::InstrInfoQuery::hasNoUnsignedWrap(), I, Idx, llvm::SimplifyQuery::IIQ, llvm::KnownBits::insertBits(), llvm::KnownBits::intersectWith(), llvm::KnownBits::isConstant(), llvm::InstrInfoQuery::isExact(), llvm::isGuaranteedNotToBePoison(), llvm::Type::isIntOrPtrTy(), llvm::DataLayout::isLittleEndian(), llvm::SelectPatternResult::isMinOrMax(), llvm::KnownBits::isNegative(), llvm::KnownBits::isNonNegative(), llvm::Type::isPointerTy(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::isScalable(), llvm::Type::isSized(), llvm::KnownBits::isUnknown(), llvm::Type::isVectorTy(), llvm::APInt::isZero(), llvm::Constant::isZeroValue(), LHS, llvm_unreachable, llvm::Log2(), llvm::KnownBits::lshr(), llvm::APInt::lshr(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_BasicBlock(), llvm::PatternMatch::m_Br(), llvm::PatternMatch::m_c_ICmp(), llvm::PatternMatch::m_Neg(), llvm::PatternMatch::m_One(), llvm::PatternMatch::m_Specific(), llvm::KnownBits::makeConstant(), llvm::ConstantRange::makeExactICmpRegion(), llvm::KnownBits::makeNegative(), llvm::KnownBits::makeNonNegative(), llvm::PatternMatch::match(), matchSelectPattern(), llvm::matchSimpleRecurrence(), llvm::MaxAnalysisRecursionDepth, llvm::KnownBits::mul(), llvm::Offset, llvm::KnownBits::One, P, llvm::KnownBits::resetAll(), llvm::APInt::reverseBits(), RHS, llvm::KnownBits::sadd_sat(), llvm::KnownBits::sdiv(), llvm::APInt::setAllBits(), llvm::APInt::setBit(), llvm::APInt::setBitsFrom(), llvm::APInt::setHighBits(), llvm::APInt::setLowBits(), llvm::APInt::setSignBit(), llvm::KnownBits::sext(), llvm::KnownBits::sextOrTrunc(), llvm::APInt::sextOrTrunc(), llvm::KnownBits::shl(), llvm::APInt::shl(), llvm::KnownBits::smax(), llvm::KnownBits::smin(), llvm::SPF_ABS, llvm::SPF_SMAX, llvm::SPF_SMIN, llvm::SPF_UMAX, llvm::SPF_UMIN, llvm::KnownBits::srem(), llvm::KnownBits::ssub_sat(), llvm::ConstantRange::toKnownBits(), llvm::KnownBits::trunc(), llvm::KnownBits::uadd_sat(), llvm::KnownBits::udiv(), llvm::KnownBits::umax(), llvm::KnownBits::umin(), llvm::KnownBits::unionWith(), llvm::APInt::urem(), llvm::KnownBits::urem(), llvm::KnownBits::usub_sat(), llvm::KnownBits::Zero, and llvm::KnownBits::zextOrTrunc().
Referenced by computeKnownBits().
|
static |
Compute known bits from a shift operator, including those with a non-constant shift amount.
Known is the output of this function. Known2 is a pre-allocated temporary with the same bit width as Known and on return contains the known bit of the shift value source. KF is an operator-specific function that, given the known-bits and a shift amount, compute the implied known-bits of the shift operator's result respectively for that shift amount. The results from calling KF are conservatively combined for all permitted shift amounts.
Definition at line 864 of file ValueTracking.cpp.
References computeKnownBits(), llvm::Depth, llvm::KnownBits::getBitWidth(), llvm::KnownBits::getMaxValue(), I, isKnownNonZero(), llvm::KnownBits::isNonZero(), and llvm::APInt::ult().
Referenced by computeKnownBitsFromOperator().
|
static |
Definition at line 392 of file ValueTracking.cpp.
References llvm::SimplifyQuery::AC, computeKnownBits(), llvm::SimplifyQuery::CxtI, llvm::Depth, llvm::SimplifyQuery::DT, isGuaranteedNotToBeUndefOrPoison(), llvm::isKnownNegative(), llvm::isKnownNonNegative(), llvm::KnownBits::isNegative(), llvm::KnownBits::isNonNegative(), llvm::KnownBits::isNonZero(), llvm::KnownBits::makeNegative(), llvm::KnownBits::makeNonNegative(), and llvm::KnownBits::mul().
Referenced by computeKnownBitsFromOperator().
void computeKnownFPClass | ( | const Value * | V, |
const APInt & | DemandedElts, | ||
FPClassTest | InterestedClasses, | ||
KnownFPClass & | Known, | ||
unsigned | Depth, | ||
const SimplifyQuery & | Q | ||
) |
Definition at line 4304 of file ValueTracking.cpp.
References llvm::SimplifyQuery::AC, assert(), llvm::BitWidth, llvm::KnownFPClass::cannotBeOrderedGreaterThanZero(), llvm::KnownFPClass::cannotBeOrderedLessThanZero(), llvm::APInt::clearBit(), llvm::computeConstantRange(), llvm::computeKnownBits(), llvm::computeKnownFPClass(), computeKnownFPClassForFPTrunc(), computeKnownFPClassFromAssumes(), Cond, llvm::KnownFPClass::copysign(), llvm::SimplifyQuery::CxtI, llvm::Depth, llvm::SimplifyQuery::DT, F, llvm::KnownFPClass::fabs(), llvm::fcAllFlags, llvm::fcInf, llvm::fcmpToClassTest(), llvm::fcNan, llvm::fcNegative, llvm::fcNegFinite, llvm::fcNegInf, llvm::fcNegNormal, llvm::fcNegSubnormal, llvm::fcNegZero, llvm::fcNone, llvm::fcPosFinite, llvm::fcPosInf, llvm::fcPositive, llvm::fcPosNormal, llvm::fcPosSubnormal, llvm::fcPosZero, llvm::fcQNan, llvm::fcSNan, llvm::fcSubnormal, llvm::fcZero, llvm::First, Flt, llvm::KnownFPClass::fneg(), llvm::Constant::getAggregateElement(), llvm::ExtractValueInst::getAggregateOperand(), llvm::APInt::getAllOnes(), llvm::CallBase::getArgOperand(), llvm::APInt::getBitWidth(), llvm::Function::getDenormalMode(), llvm::Type::getFltSemantics(), llvm::Instruction::getFunction(), llvm::DenormalMode::getIEEE(), llvm::ExtractValueInst::getIndices(), llvm::Type::getIntegerBitWidth(), llvm::CallBase::getIntrinsicID(), llvm::APFloat::getLargest(), llvm::APInt::getOneBitSet(), llvm::Type::getScalarType(), llvm::getShuffleDemandedElts(), llvm::ConstantRange::getSignedMin(), llvm::ConstantRange::getSingleElement(), llvm::Value::getType(), llvm::InstrInfoQuery::hasNoSignedZeros(), Idx, llvm::DenormalMode::IEEE, llvm::SimplifyQuery::IIQ, llvm::DenormalMode::Input, llvm::DenormalMode::inputsAreZero(), llvm::ConstantRange::isAllNegative(), llvm::ConstantRange::isAllNonNegative(), llvm::KnownFPClass::isKnownNever(), llvm::KnownFPClass::isKnownNeverInfinity(), llvm::KnownFPClass::isKnownNeverLogicalNegZero(), llvm::KnownFPClass::isKnownNeverLogicalPosZero(), llvm::KnownFPClass::isKnownNeverLogicalZero(), llvm::KnownFPClass::isKnownNeverNaN(), llvm::KnownFPClass::isKnownNeverNegInfinity(), llvm::KnownFPClass::isKnownNeverNegSubnormal(), llvm::KnownFPClass::isKnownNeverPosInfinity(), llvm::KnownFPClass::isKnownNeverPosSubnormal(), llvm::KnownFPClass::isKnownNeverSubnormal(), llvm::APFloatBase::isRepresentableAsNormalIn(), llvm::KnownFPClass::isUnknown(), llvm::APInt::isZero(), llvm::KnownFPClass::KnownFPClasses, llvm::KnownFPClass::knownNot(), LHS, llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_FCmp(), llvm::PatternMatch::m_Value(), llvm::make_scope_exit(), llvm::PatternMatch::match(), llvm::MaxAnalysisRecursionDepth, llvm::KnownFPClass::OrderedGreaterThanZeroMask, llvm::KnownFPClass::OrderedLessThanZeroMask, llvm::DenormalMode::Output, outputDenormalIsIEEEOrPosZero(), llvm::DenormalMode::outputsAreZero(), P, llvm::DenormalMode::PositiveZero, llvm::KnownFPClass::propagateCanonicalizingSrc(), llvm::KnownFPClass::propagateNaN(), llvm::KnownFPClass::resetAll(), RHS, llvm::APFloatBase::semanticsPrecision(), llvm::APInt::sge(), llvm::KnownFPClass::SignBit, llvm::KnownFPClass::signBitMustBeZero(), llvm::ArrayRef< T >::size(), llvm::InstrInfoQuery::UseInstrInfo, and llvm::KnownBits::Zero.
|
static |
Definition at line 4271 of file ValueTracking.cpp.
References llvm::computeKnownFPClass(), llvm::Depth, and llvm::APInt::getAllOnes().
|
static |
Definition at line 4280 of file ValueTracking.cpp.
References llvm::KnownFPClass::cannotBeOrderedLessThanZero(), llvm::computeKnownFPClass(), llvm::Depth, llvm::fcNan, llvm::fcNone, llvm::KnownFPClass::knownNot(), llvm::KnownFPClass::OrderedLessThanZeroMask, and llvm::KnownFPClass::propagateNaN().
Referenced by computeKnownFPClass().
|
static |
Definition at line 4220 of file ValueTracking.cpp.
References llvm::SimplifyQuery::AC, assert(), llvm::AssumptionCache::assumptionsFor(), llvm::SimplifyQuery::CxtI, llvm::SimplifyQuery::DT, F, llvm::fcAllFlags, llvm::fcmpToClassTest(), llvm::BasicBlock::getParent(), llvm::Instruction::getParent(), I, llvm::isValidAssumeForContext(), LHS, llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_FCmp(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), and RHS.
Referenced by computeKnownFPClass().
|
static |
Definition at line 3268 of file ValueTracking.cpp.
References assert(), ComputeNumSignBitsImpl(), and llvm::Depth.
Referenced by llvm::ComputeMaxSignificantBits(), ComputeNumSignBits(), and ComputeNumSignBitsImpl().
|
static |
Definition at line 352 of file ValueTracking.cpp.
References ComputeNumSignBits(), llvm::Depth, and llvm::APInt::getAllOnes().
|
static |
Return the number of times the sign bit of the register is replicated into the other bits.
We know that at least 1 bit is always equal to the sign bit (itself), but other cases can give us information. For example, immediately after an "ashr X, 2", we know that the top 3 bits are all equal to each other, so we return 3. For vectors, return the number of sign bits for the vector element with the minimum number of known sign bits of the demanded elements in the vector specified by DemandedElts.
Definition at line 3282 of file ValueTracking.cpp.
References assert(), llvm::APInt::ceilLogBase2(), computeKnownBits(), ComputeNumSignBits(), computeNumSignBitsVectorConstant(), llvm::KnownBits::countMinSignBits(), llvm::SimplifyQuery::CxtI, llvm::Depth, llvm::SimplifyQuery::DL, llvm::APInt::getBitWidth(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::PHINode::getNumIncomingValues(), llvm::APInt::getNumSignBits(), llvm::Operator::getOpcode(), llvm::DataLayout::getPointerTypeSizeInBits(), llvm::Type::getScalarType(), getShuffleDemandedElts(), llvm::BasicBlock::getTerminator(), llvm::DataLayout::getTypeSizeInBits(), llvm::APInt::getZExtValue(), llvm::KnownBits::isNonNegative(), llvm::Type::isPointerTy(), isSignedMinMaxClamp(), isSignedMinMaxIntrinsicClamp(), llvm::APInt::isStrictlyPositive(), LHS, llvm::APInt::logBase2(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::match(), llvm::MaxAnalysisRecursionDepth, RHS, llvm::APInt::uge(), X, and llvm::KnownBits::Zero.
Referenced by ComputeNumSignBits().
|
static |
For vector constants, loop over the elements and find the constant with the minimum number of sign bits.
Return 0 if the value is not a vector constant or if any element was not analyzed; otherwise, return the count for the element with the minimum number of sign bits.
Definition at line 3241 of file ValueTracking.cpp.
Referenced by ComputeNumSignBitsImpl().
|
static |
Definition at line 6333 of file ValueTracking.cpp.
References llvm::Add, computeConstantRangeIncludingKnownBits(), llvm::computeKnownBitsFromAssume(), llvm::ComputeNumSignBits(), DL, llvm::ConstantRange::getBitWidth(), llvm::ConstantRange::isAllNegative(), llvm::ConstantRange::isAllNonNegative(), llvm::KnownBits::isNegative(), llvm::KnownBits::isNonNegative(), LHS, mapOverflowResult(), llvm::MayOverflow, llvm::NeverOverflows, RHS, and llvm::ConstantRange::signedAddMayOverflow().
|
static |
Definition at line 6708 of file ValueTracking.cpp.
References llvm::any_of(), llvm::CallBase::args(), llvm::Depth, I, llvm::is_contained(), llvm::PatternMatch::m_ExtractValue(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_WithOverflowInst(), llvm::PatternMatch::match(), and MaxDepth.
Referenced by impliesPoison().
|
static |
Returns the bitwidth of the given scalar or pointer type.
For vector types, returns the element type's bitwidth.
Definition at line 91 of file ValueTracking.cpp.
References llvm::BitWidth, DL, and llvm::Type::getScalarSizeInBits().
Referenced by canConvertValue(), llvm::FunctionComparator::cmpTypes(), combineAnd(), combineOr(), computeKnownBits(), llvm::APInt::concat(), DecodeFixedType(), llvm::AMDGPULibFuncBase::Param::getFromTy(), getMangledTypeStr(), llvm::SelectionDAG::getNode(), getTargetConstantBitsFromNode(), getTypeID(), llvm::MVT::getVT(), instCombineSVECondLast(), isKnownNonZeroFromOperator(), LLVMCreateGenericValueOfInt(), llvm::ExecutionEngine::LoadValueFromMemory(), and llvm::APInt::operator[]().
|
static |
Definition at line 8415 of file ValueTracking.cpp.
References assert(), llvm::Instruction::getParent(), llvm::BasicBlock::getSinglePredecessor(), llvm::BasicBlock::getTerminator(), llvm::PatternMatch::m_Br(), llvm::PatternMatch::m_Value(), and llvm::PatternMatch::match().
Referenced by llvm::isImpliedByDomCondition().
|
static |
If the pair of operators are the same invertible function, return the the operands of the function corresponding to each input.
Otherwise, return std::nullopt. An invertible function is one that is 1-to-1 and maps every input value to exactly one output value. This is equivalent to saying that Op1 and Op2 are equal exactly when the specified pair of operands are equal, (except that Op1 and Op2 may be poison more often.)
Definition at line 2948 of file ValueTracking.cpp.
References getInvertibleOperands(), llvm::Operator::getOpcode(), llvm::User::getOperand(), getOperands(), llvm::Instruction::getParent(), llvm::Value::getType(), and llvm::matchSimpleRecurrence().
Referenced by getInvertibleOperands(), and isKnownNonEqual().
|
static |
Definition at line 880 of file ValueTracking.cpp.
References llvm::BitWidth, llvm::KnownBits::blsi(), llvm::KnownBits::blsmsk(), computeKnownBits(), llvm::KnownBits::countMaxTrailingZeros(), llvm::KnownBits::countMinTrailingOnes(), llvm::Depth, llvm::KnownBits::getBitWidth(), I, llvm::APInt::isZero(), llvm_unreachable, llvm::PatternMatch::m_AllOnes(), llvm::PatternMatch::m_c_Add(), llvm::PatternMatch::m_c_And(), llvm::PatternMatch::m_c_BinOp(), llvm::PatternMatch::m_c_Xor(), llvm::PatternMatch::m_Deferred(), llvm::PatternMatch::m_Neg(), llvm::PatternMatch::m_Sub(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::KnownBits::One, llvm::APInt::setBit(), X, Y, and llvm::KnownBits::Zero.
Referenced by llvm::analyzeKnownBitsFromAndXorOr(), and computeKnownBitsFromOperator().
If the input value is the result of a 'not' op, constant integer, or vector splat of a constant integer, return the bitwise-not source value.
TODO: This could be extended to handle non-splat vector integer constants.
Definition at line 7509 of file ValueTracking.cpp.
References llvm::CallingConv::C, llvm::ConstantInt::get(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_Value(), and llvm::PatternMatch::match().
Referenced by matchMinMax().
|
static |
Definition at line 8630 of file ValueTracking.cpp.
References llvm::CallingConv::C, llvm::Instruction::getFunction(), llvm::IntrinsicInst::getIntrinsicID(), llvm::APInt::getMaxValue(), llvm::ConstantRange::getNonEmpty(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::Type::getScalarSizeInBits(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), llvm::Value::getType(), llvm::getVScaleRange(), llvm::APInt::getZero(), llvm_unreachable, llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_One(), and llvm::PatternMatch::match().
Referenced by llvm::computeConstantRange().
|
static |
Definition at line 132 of file ValueTracking.cpp.
References assert(), llvm::User::getOperand(), llvm::getShuffleDemandedElts(), llvm::ShuffleVectorInst::getShuffleMask(), llvm::ShuffleVectorInst::getType(), and llvm::Value::getType().
Referenced by computeKnownBitsFromOperator(), and ComputeNumSignBitsImpl().
|
static |
If we can compute the length of the string pointed to by the specified pointer, return 'len+1'.
If we can't, return 0.
Definition at line 5738 of file ValueTracking.cpp.
References llvm::ConstantDataArraySlice::Array, E, llvm::getConstantDataArrayInfo(), llvm::ConstantDataSequential::getElementAsInteger(), GetStringLengthH(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::ConstantDataArraySlice::Length, and llvm::ConstantDataArraySlice::Offset.
Referenced by llvm::GetStringLength(), and GetStringLengthH().
This is the function that does the work of looking through basic ptrtoint+arithmetic+inttoptr sequences.
Definition at line 5967 of file ValueTracking.cpp.
References assert(), and llvm::Operator::getOpcode().
Referenced by llvm::getUnderlyingObjectsForCodeGen().
|
static |
Definition at line 6736 of file ValueTracking.cpp.
References llvm::all_of(), llvm::canCreatePoison(), llvm::Depth, directlyImpliesPoison(), I, llvm::isGuaranteedNotToBePoison(), and MaxDepth.
Return true if it's possible to assume IEEE treatment of input denormals in F
for Val
.
Definition at line 3913 of file ValueTracking.cpp.
References F, llvm::Type::getFltSemantics(), llvm::Type::getScalarType(), and llvm::DenormalMode::IEEE.
Referenced by llvm::fcmpToClassTest(), fpclassTestIsFCmp0(), and llvm::KnownFPClass::isKnownNeverLogicalZero().
Definition at line 3918 of file ValueTracking.cpp.
References F, llvm::Type::getFltSemantics(), llvm::Type::getScalarType(), llvm::DenormalMode::IEEE, and llvm::DenormalMode::PositiveZero.
Referenced by llvm::KnownFPClass::isKnownNeverLogicalNegZero().
|
static |
Return true if V2 == V1 + X, where X is known non-zero.
Definition at line 3049 of file ValueTracking.cpp.
References llvm::Depth, llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), and isKnownNonZero().
Referenced by isKnownNonEqual().
|
static |
Definition at line 468 of file ValueTracking.cpp.
References llvm::all_of(), llvm::append_range(), E, llvm::SmallVectorBase< Size_T >::empty(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::is_contained(), mayHaveSideEffects(), and llvm::SmallVectorImpl< T >::pop_back_val().
Referenced by llvm::isValidAssumeForContext().
|
static |
Test whether a GEP's result is known to be non-null.
Uses properties inherent in a GEP to try to determine whether it is known to be non-null.
Currently this routine does not support vector GEPs.
Definition at line 2171 of file ValueTracking.cpp.
References assert(), llvm::Depth, llvm::SimplifyQuery::DL, F, GEP, llvm::gep_type_begin(), llvm::gep_type_end(), llvm::StructLayout::getElementOffset(), llvm::DataLayout::getStructLayout(), llvm::DataLayout::getTypeAllocSize(), llvm::ConstantInt::getZExtValue(), I, isKnownNonZero(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::isZero(), llvm::MaxAnalysisRecursionDepth, and llvm::NullPointerIsDefined().
Referenced by isKnownNonZeroFromOperator().
|
static |
Definition at line 6764 of file ValueTracking.cpp.
References A, llvm::all_of(), llvm::any_of(), llvm::CallingConv::C, llvm::canCreateUndefOrPoison(), Cond, llvm::Depth, llvm::DomTreeNodeBase< NodeT >::getBlock(), llvm::DomTreeNodeBase< NodeT >::getIDom(), llvm::getKnowledgeValidInContext(), llvm::DominatorTreeBase< NodeT, IsPostDom >::getNode(), llvm::Instruction::getParent(), I, llvm::isGuaranteedNotToBeUndefOrPoison(), llvm::MaxAnalysisRecursionDepth, and llvm::programUndefinedIfUndefOrPoison().
Referenced by computeKnownBitsMul().
|
static |
Return true if LHS implies RHS is true.
Return false if LHS implies RHS is false. Otherwise, return std::nullopt if we can't infer anything. We expect the RHS to be an icmp and the LHS to be an 'and', 'or', or a 'select' instruction.
Definition at line 8306 of file ValueTracking.cpp.
References assert(), llvm::Depth, DL, llvm::isImpliedCondition(), LHS, llvm::PatternMatch::m_LogicalAnd(), llvm::PatternMatch::m_LogicalOr(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), and llvm::MaxAnalysisRecursionDepth.
Referenced by llvm::isImpliedCondition().
|
static |
Return true if "icmp LPred X, LC" implies "icmp RPred X, RC" is true.
Return false if "icmp LPred X, LC" implies "icmp RPred X, RC" is false. Otherwise, return std::nullopt if we can't infer anything.
Definition at line 8254 of file ValueTracking.cpp.
References llvm::ConstantRange::difference(), llvm::ConstantRange::intersectWith(), llvm::ConstantRange::isEmptySet(), and llvm::ConstantRange::makeExactICmpRegion().
Referenced by isImpliedCondICmps().
|
static |
Return true if LHS implies RHS (expanded to its components as "R0 RPred R1") is true.
Return false if LHS implies RHS is false. Otherwise, return std::nullopt if we can't infer anything.
Definition at line 8271 of file ValueTracking.cpp.
References areMatchingOperands(), llvm::Depth, DL, isImpliedCondCommonOperandWithConstants(), isImpliedCondMatchingOperands(), isImpliedCondOperands(), LHS, llvm::PatternMatch::m_APInt(), and llvm::PatternMatch::match().
Referenced by llvm::isImpliedCondition().
|
static |
Return true if "icmp1 LPred X, Y" implies "icmp2 RPred X, Y" is true.
Return false if "icmp1 LPred X, Y" implies "icmp2 RPred X, Y" is false. Otherwise, return std::nullopt if we can't infer anything.
Definition at line 8237 of file ValueTracking.cpp.
References llvm::CmpInst::getSwappedPredicate(), llvm::CmpInst::isImpliedFalseByMatchingCmp(), and llvm::CmpInst::isImpliedTrueByMatchingCmp().
Referenced by isImpliedCondICmps().
|
static |
Return true if "icmp Pred BLHS BRHS" is true whenever "icmp Pred ALHS ARHS" is true.
Otherwise, return std::nullopt.
Definition at line 8186 of file ValueTracking.cpp.
References llvm::Depth, DL, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, and isTruePredicate().
Referenced by isImpliedCondICmps().
|
static |
Return true if it is known that V1 != V2.
Definition at line 3121 of file ValueTracking.cpp.
References computeKnownBits(), llvm::Depth, getInvertibleOperands(), llvm::Value::getType(), llvm::APInt::intersects(), isAddOfNonZero(), llvm::Type::isIntOrIntVectorTy(), isKnownNonEqual(), isNonEqualMul(), isNonEqualPHIs(), isNonEqualShl(), llvm::MaxAnalysisRecursionDepth, llvm::KnownBits::One, and llvm::KnownBits::Zero.
Referenced by isKnownNonEqual(), and isNonEqualPHIs().
|
static |
Definition at line 7279 of file ValueTracking.cpp.
References llvm::CallingConv::C, E, I, and llvm::FastMathFlags::noNaNs().
Referenced by matchSelectPattern().
|
static |
Definition at line 2232 of file ValueTracking.cpp.
References assert(), cmpExcludesZero(), DomConditionsMaxUses, llvm::DominatorTree::dominates(), llvm::SmallVectorBase< Size_T >::empty(), llvm::CmpInst::getInversePredicate(), llvm::getLoadStorePointerOperand(), llvm::Instruction::getParent(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::isGuard(), llvm::BasicBlockEdge::isSingleEdge(), llvm::PatternMatch::m_c_ICmp(), llvm::PatternMatch::m_LogicalAnd(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::NullPointerIsDefined(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and RHS.
Referenced by isKnownNonZero().
Definition at line 7302 of file ValueTracking.cpp.
References llvm::CallingConv::C, E, and I.
|
static |
Return true if the given value is known to be non-zero when defined.
For vectors, return true if every demanded element is known to be non-zero when defined. For pointers, if the context instruction and dominator tree are specified, perform context-sensitive analysis and return true if the pointer couldn't possibly be null at the specified instruction. Supports values with integer or pointer type and vectors of integers.
Definition at line 2838 of file ValueTracking.cpp.
References A, assert(), llvm::CallingConv::C, llvm::SimplifyQuery::CxtI, llvm::Depth, llvm::SimplifyQuery::DT, llvm::APInt::getBitWidth(), llvm::InstrInfoQuery::getMetadata(), I, llvm::SimplifyQuery::IIQ, isKnownNonNullFromDominatingCondition(), isKnownNonZeroFromAssume(), isKnownNonZeroFromOperator(), llvm::Constant::isNullValue(), llvm::MaxAnalysisRecursionDepth, llvm::NullPointerIsDefined(), and rangeMetadataExcludesValue().
Referenced by computeKnownBitsFromShiftOperator(), isAddOfNonZero(), isGEPKnownNonNull(), isKnownNonZero(), isKnownNonZeroFromOperator(), llvm::isKnownPositive(), isNonEqualMul(), isNonEqualShl(), isNonZeroAdd(), isNonZeroShift(), and isNonZeroSub().
Definition at line 2934 of file ValueTracking.cpp.
References llvm::Depth, llvm::APInt::getAllOnes(), and isKnownNonZero().
|
static |
Definition at line 583 of file ValueTracking.cpp.
References llvm::SimplifyQuery::AC, assert(), llvm::AssumptionCache::assumptionsFor(), cmpExcludesZero(), llvm::SimplifyQuery::CxtI, llvm::SimplifyQuery::DT, llvm::Instruction::getFunction(), llvm::getKnowledgeValidInContext(), I, llvm::isValidAssumeForContext(), llvm::PatternMatch::m_c_ICmp(), llvm::PatternMatch::m_CombineOr(), llvm::PatternMatch::m_PtrToInt(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::NullPointerIsDefined(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and RHS.
Referenced by isKnownNonZero().
|
static |
Definition at line 2477 of file ValueTracking.cpp.
References llvm::KnownBits::abs(), llvm::SimplifyQuery::AC, llvm::all_of(), llvm::BitWidth, cmpExcludesZero(), computeKnownBits(), llvm::KnownBits::countMaxTrailingZeros(), llvm::SimplifyQuery::CxtI, llvm::Depth, llvm::SimplifyQuery::DL, llvm::SimplifyQuery::DT, llvm::APInt::getAllOnes(), llvm::getArgumentAliasingToReturnedPointer(), getBitWidth(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::getFixedValue(), llvm::InstrInfoQuery::getMetadata(), llvm::APInt::getOneBitSet(), llvm::Type::getScalarType(), llvm::Value::getType(), llvm::DataLayout::getTypeSizeInBits(), llvm::InstrInfoQuery::hasNoSignedWrap(), llvm::InstrInfoQuery::hasNoUnsignedWrap(), I, Idx, llvm::SimplifyQuery::IIQ, llvm::PossiblyExactOperator::isExact(), isGEPKnownNonNull(), llvm::isGuaranteedNotToBePoison(), llvm::Type::isIntOrIntVectorTy(), isKnownNonZero(), llvm::KnownBits::isNegative(), llvm::KnownBits::isNonZero(), isNonZeroAdd(), isNonZeroRecurrence(), isNonZeroShift(), isNonZeroSub(), llvm::Type::isPtrOrPtrVectorTy(), llvm::KnownBits::isUnknown(), llvm::PatternMatch::m_c_ICmp(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::MaxAnalysisRecursionDepth, llvm::NullPointerIsDefined(), llvm::KnownBits::One, llvm::KnownBits::uge(), llvm::InstrInfoQuery::UseInstrInfo, and X.
Referenced by isKnownNonZero().
|
static |
Return true if the given value is known to have exactly one bit set when defined.
For vectors return true if every element is known to be a power of two when defined. Supports values with integer or pointer types and vectors of integers.
Definition at line 2005 of file ValueTracking.cpp.
References llvm::all_of(), assert(), llvm::BitWidth, computeKnownBits(), llvm::SimplifyQuery::CxtI, llvm::Depth, F, llvm::APInt::getBoolValue(), llvm::Instruction::getFunction(), llvm::InstrInfoQuery::hasNoSignedWrap(), llvm::InstrInfoQuery::hasNoUnsignedWrap(), I, llvm::SimplifyQuery::IIQ, llvm::InstrInfoQuery::isExact(), isKnownToBeAPowerOfTwo(), isPowerOfTwoRecurrence(), llvm::PatternMatch::m_c_And(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_Neg(), llvm::PatternMatch::m_One(), llvm::PatternMatch::m_Power2(), llvm::PatternMatch::m_Power2OrZero(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_SignMask(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_VScale(), llvm::PatternMatch::match(), llvm::MaxAnalysisRecursionDepth, llvm::KnownBits::One, and llvm::KnownBits::Zero.
Referenced by isKnownToBeAPowerOfTwo(), isNonZeroAdd(), and isPowerOfTwoRecurrence().
|
static |
Return true if V2 == V1 * C, where V1 is known non-zero, C is not 0/1 and the multiplication is nuw or nsw.
Definition at line 3066 of file ValueTracking.cpp.
References llvm::CallingConv::C, llvm::Depth, isKnownNonZero(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_Mul(), llvm::PatternMatch::m_Specific(), and llvm::PatternMatch::match().
Referenced by isKnownNonEqual().
|
static |
Definition at line 3090 of file ValueTracking.cpp.
References llvm::PHINode::blocks(), llvm::SimplifyQuery::CxtI, llvm::Depth, llvm::PHINode::getIncomingValueForBlock(), llvm::Instruction::getParent(), llvm::SmallPtrSetImpl< PtrType >::insert(), isKnownNonEqual(), llvm::PatternMatch::m_APInt(), and llvm::PatternMatch::match().
Referenced by isKnownNonEqual().
|
static |
Return true if V2 == V1 << C, where V1 is known non-zero, C is not 0 and the shift is nuw or nsw.
Definition at line 3079 of file ValueTracking.cpp.
References llvm::CallingConv::C, llvm::Depth, isKnownNonZero(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Specific(), and llvm::PatternMatch::match().
Referenced by isKnownNonEqual().
|
static |
Definition at line 2369 of file ValueTracking.cpp.
References llvm::BitWidth, llvm::KnownBits::computeForAddSub(), computeKnownBits(), llvm::Depth, llvm::APInt::getSignedMaxValue(), llvm::APInt::intersects(), isKnownNonZero(), isKnownToBeAPowerOfTwo(), llvm::KnownBits::isNegative(), llvm::KnownBits::isNonNegative(), llvm::KnownBits::isNonZero(), llvm::KnownBits::One, X, and Y.
Referenced by isKnownNonZeroFromOperator().
Try to detect a recurrence that monotonically increases/decreases from a non-zero starting value.
These are common as induction variables.
Definition at line 2341 of file ValueTracking.cpp.
References llvm::BinaryOperator::getOpcode(), llvm::Instruction::hasNoSignedWrap(), llvm::Instruction::hasNoUnsignedWrap(), llvm::Instruction::isExact(), llvm::APInt::isNegative(), llvm::APInt::isZero(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::match(), and llvm::matchSimpleRecurrence().
Referenced by isKnownNonZeroFromOperator().
|
static |
Definition at line 2426 of file ValueTracking.cpp.
References llvm::APInt::ashr(), computeKnownBits(), llvm::Depth, llvm::APInt::getAllOnes(), llvm::KnownBits::getBitWidth(), llvm::KnownBits::getMaxValue(), I, isKnownNonZero(), llvm::KnownBits::isUnknown(), llvm_unreachable, llvm::APInt::lshr(), llvm::KnownBits::One, llvm::APInt::shl(), llvm::APInt::uge(), and llvm::KnownBits::Zero.
Referenced by isKnownNonZeroFromOperator().
|
static |
Definition at line 2408 of file ValueTracking.cpp.
References llvm::CallingConv::C, computeKnownBits(), llvm::Depth, isKnownNonZero(), llvm::KnownBits::isUnknown(), llvm::KnownBits::ne(), X, and Y.
Referenced by isKnownNonZeroFromOperator().
|
static |
Try to detect a recurrence that the value of the induction variable is always a power of two (or zero).
Definition at line 1946 of file ValueTracking.cpp.
References llvm::SimplifyQuery::CxtI, llvm::Depth, llvm::PHINode::getIncomingBlock(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::BasicBlock::getTerminator(), llvm::InstrInfoQuery::hasNoSignedWrap(), llvm::InstrInfoQuery::hasNoUnsignedWrap(), llvm::SimplifyQuery::IIQ, llvm::InstrInfoQuery::isExact(), isKnownToBeAPowerOfTwo(), llvm::PatternMatch::m_Power2(), llvm::PatternMatch::m_SignMask(), llvm::PatternMatch::match(), llvm::matchSimpleRecurrence(), and llvm::User::operands().
Referenced by isKnownToBeAPowerOfTwo().
PN
defines a loop-variant pointer to an object.
Check if the previous iteration of the loop was referring to the same object as PN
.
Definition at line 5855 of file ValueTracking.cpp.
References llvm::PHINode::getIncomingValue(), llvm::LoopInfoBase< BlockT, LoopT >::getLoopFor(), llvm::PHINode::getNumIncomingValues(), and llvm::Instruction::getParent().
Referenced by llvm::getUnderlyingObjects().
|
static |
Definition at line 3190 of file ValueTracking.cpp.
References assert(), llvm::SelectPatternResult::Flavor, llvm::getInverseMinMaxFlavor(), getOpcode(), LHS, llvm::PatternMatch::m_APInt(), llvm::PatternMatch::match(), matchSelectPattern(), RHS, Select, llvm::APInt::sle(), llvm::SPF_SMAX, llvm::SPF_SMIN, and std::swap().
Referenced by ComputeNumSignBitsImpl().
|
static |
Definition at line 3219 of file ValueTracking.cpp.
References assert(), llvm::CallBase::getArgOperand(), llvm::IntrinsicInst::getIntrinsicID(), llvm::getInverseMinMaxIntrinsic(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::match(), llvm::APInt::sle(), and std::swap().
Referenced by ComputeNumSignBitsImpl().
|
static |
Return true if "icmp Pred LHS RHS" is always true.
Definition at line 8122 of file ValueTracking.cpp.
References A, B, llvm::CallingConv::C, llvm::computeKnownBits(), llvm::Depth, DL, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::isTrueWhenEqual(), LHS, llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_NSWAdd(), llvm::PatternMatch::m_NUWAdd(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), RHS, llvm::APInt::ule(), X, and llvm::KnownBits::Zero.
Referenced by isImpliedCondOperands().
|
static |
Helps to match a select pattern in case of a type mismatch.
The function processes the case when type of true and false values of a select instruction differs from type of the cmp instruction operands because of a cast instruction. The function checks if it is legal to move the cast operation after "select". If yes, it returns the new second value of "select" (with the assumption that cast is moved):
Definition at line 7818 of file ValueTracking.cpp.
References llvm::CallingConv::C, llvm::ConstantExpr::getCast(), llvm::ConstantExpr::getFPExtend(), llvm::ConstantExpr::getFPToSI(), llvm::ConstantExpr::getFPToUI(), llvm::ConstantExpr::getFPTrunc(), llvm::ConstantExpr::getIntegerCast(), llvm::User::getOperand(), llvm::ConstantExpr::getSIToFP(), llvm::ConstantExpr::getTrunc(), llvm::Value::getType(), llvm::ConstantExpr::getUIToFP(), llvm::CmpInst::isSigned(), llvm::CmpInst::isUnsigned(), llvm::PatternMatch::m_Constant(), and llvm::PatternMatch::match().
Referenced by llvm::matchDecomposedSelectPattern().
|
static |
Convert ConstantRange OverflowResult into ValueTracking OverflowResult.
Definition at line 6238 of file ValueTracking.cpp.
References llvm::AlwaysOverflowsHigh, llvm::ConstantRange::AlwaysOverflowsHigh, llvm::AlwaysOverflowsLow, llvm::ConstantRange::AlwaysOverflowsLow, llvm_unreachable, llvm::MayOverflow, llvm::ConstantRange::MayOverflow, llvm::NeverOverflows, and llvm::ConstantRange::NeverOverflows.
Referenced by computeOverflowForSignedAdd(), llvm::computeOverflowForSignedSub(), llvm::computeOverflowForUnsignedAdd(), llvm::SelectionDAG::computeOverflowForUnsignedAdd(), llvm::computeOverflowForUnsignedMul(), llvm::SelectionDAG::computeOverflowForUnsignedMul(), and llvm::computeOverflowForUnsignedSub().
|
static |
Return true if 'V & Mask' is known to be zero.
We use this predicate to simplify operations downstream. Mask is known to be zero for bits that V cannot have.
This function is defined on values with integer type, values with pointer type, and vectors of integers. In the case where V is a vector, the mask, known zero, and known one values are the same width as the vector element, and the bit is set only if it is true for all of the elements in the vector.
Definition at line 3181 of file ValueTracking.cpp.
References computeKnownBits(), llvm::Depth, and llvm::KnownBits::Zero.
|
static |
Recognize variations of: CLAMP(v,l,h) ==> ((v) < (l) ? (l) : ((v) > (h) ? (h) : (v)))
Definition at line 7377 of file ValueTracking.cpp.
References llvm::CmpInst::getSwappedPredicate(), llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULT, llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_SMax(), llvm::PatternMatch::m_SMin(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_UMax(), llvm::PatternMatch::m_UMin(), llvm::PatternMatch::match(), llvm::APInt::sgt(), llvm::APInt::slt(), llvm::SPF_SMAX, llvm::SPF_SMIN, llvm::SPF_UMAX, llvm::SPF_UMIN, llvm::SPF_UNKNOWN, llvm::SPNB_NA, std::swap(), llvm::APInt::ugt(), and llvm::APInt::ult().
Referenced by matchMinMax().
|
static |
Match clamp pattern for float types without care about NaNs or signed zeros.
Given non-min/max outer cmp/select from the clamp pattern this function recognizes if it can be substitued by a "canonical" min/max pattern.
Definition at line 7323 of file ValueTracking.cpp.
References llvm::CmpInst::FCMP_OGE, llvm::CmpInst::FCMP_OGT, llvm::CmpInst::FCMP_OLE, llvm::CmpInst::FCMP_OLT, llvm::CmpInst::FCMP_UGE, llvm::CmpInst::FCMP_UGT, llvm::CmpInst::FCMP_ULE, llvm::CmpInst::FCMP_ULT, llvm::CmpInst::getInversePredicate(), llvm::APFloat::isFinite(), LHS, llvm::PatternMatch::m_APFloat(), llvm::PatternMatch::m_CombineOr(), llvm::PatternMatch::m_OrdFMax(), llvm::PatternMatch::m_OrdFMin(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_UnordFMax(), llvm::PatternMatch::m_UnordFMin(), llvm::PatternMatch::match(), RHS, llvm::SPF_FMAXNUM, llvm::SPF_FMINNUM, llvm::SPF_UNKNOWN, llvm::SPNB_NA, llvm::SPNB_RETURNS_ANY, and std::swap().
Referenced by matchSelectPattern().
|
static |
Match non-obvious integer minimum and maximum sequences.
Definition at line 7522 of file ValueTracking.cpp.
References llvm::Depth, llvm::SelectPatternResult::Flavor, getNotValue(), llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULT, llvm::APInt::isAllOnes(), llvm::APInt::isMaxSignedValue(), llvm::APInt::isMinSignedValue(), llvm::APInt::isZero(), LHS, llvm::PatternMatch::m_APInt(), llvm::PatternMatch::match(), matchClamp(), matchMinMaxOfMinMax(), RHS, llvm::SPF_SMAX, llvm::SPF_SMIN, llvm::SPF_UMAX, llvm::SPF_UMIN, llvm::SPF_UNKNOWN, and llvm::SPNB_NA.
Referenced by matchSelectPattern().
|
static |
Recognize variations of: a < c ? min(a,b) : min(b,c) ==> min(min(a,b),min(b,c))
Definition at line 7413 of file ValueTracking.cpp.
References A, assert(), B, llvm::CallingConv::C, D, llvm::Depth, llvm::CmpInst::getSwappedPredicate(), llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, llvm::CmpInst::isIntPredicate(), llvm::SelectPatternResult::isMinOrMax(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::match(), llvm::matchSelectPattern(), llvm::SPF_SMAX, llvm::SPF_SMIN, llvm::SPF_UMAX, llvm::SPF_UMIN, llvm::SPF_UNKNOWN, llvm::SPNB_NA, and std::swap().
Referenced by matchMinMax().
|
static |
Definition at line 7612 of file ValueTracking.cpp.
References llvm::Depth, llvm::CmpInst::FCMP_OGE, llvm::CmpInst::FCMP_OGT, llvm::CmpInst::FCMP_OLE, llvm::CmpInst::FCMP_OLT, llvm::CmpInst::FCMP_UGE, llvm::CmpInst::FCMP_UGT, llvm::CmpInst::FCMP_ULE, llvm::CmpInst::FCMP_ULT, llvm::CmpInst::getSwappedPredicate(), llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, llvm::CmpInst::isFPPredicate(), llvm::CmpInst::isIntPredicate(), llvm::isKnownNegation(), isKnownNonNaN(), llvm::isKnownNonZero(), llvm::CmpInst::isOrdered(), LHS, llvm::PatternMatch::m_AllOnes(), llvm::PatternMatch::m_AnyZeroFP(), llvm::PatternMatch::m_CombineOr(), llvm::PatternMatch::m_Neg(), llvm::PatternMatch::m_One(), llvm::PatternMatch::m_SExt(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_ZeroInt(), llvm::PatternMatch::match(), matchFastFloatClamp(), matchMinMax(), llvm::FastMathFlags::noSignedZeros(), RHS, llvm::SPF_ABS, llvm::SPF_FMAXNUM, llvm::SPF_FMINNUM, llvm::SPF_NABS, llvm::SPF_SMAX, llvm::SPF_SMIN, llvm::SPF_UMAX, llvm::SPF_UMIN, llvm::SPF_UNKNOWN, llvm::SPNB_NA, llvm::SPNB_RETURNS_ANY, llvm::SPNB_RETURNS_NAN, llvm::SPNB_RETURNS_OTHER, and std::swap().
Referenced by computeKnownBitsFromOperator(), and isSignedMinMaxClamp().
|
static |
Definition at line 6074 of file ValueTracking.cpp.
References llvm::User::isDroppable(), and llvm::Instruction::isLifetimeStartOrEnd().
Referenced by llvm::onlyUsedByLifetimeMarkers(), and llvm::onlyUsedByLifetimeMarkersOrDroppableInsts().
Definition at line 3925 of file ValueTracking.cpp.
References F, llvm::Type::getFltSemantics(), llvm::Type::getScalarType(), llvm::DenormalMode::IEEE, and llvm::DenormalMode::PositiveZero.
Referenced by computeKnownFPClass().
Definition at line 7173 of file ValueTracking.cpp.
References llvm::BasicBlock::begin(), llvm::SmallSet< T, N, C >::count(), llvm::BasicBlock::end(), End, llvm::Function::getEntryBlock(), llvm::BasicBlock::getFirstNonPHI(), llvm::getGuaranteedWellDefinedOps(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::BasicBlock::getParent(), llvm::BasicBlock::getSingleSuccessor(), I, llvm::SmallSet< T, N, C >::insert(), llvm::is_contained(), llvm::isGuaranteedToTransferExecutionToSuccessor(), llvm::make_range(), llvm::mustTriggerUB(), and llvm::propagatesPoison().
Does the 'Range' metadata (which must be a valid MD_range operand list) ensure that the value it's attached to is never Value? 'RangeType' is is the type of the value described by the range.
Definition at line 2324 of file ValueTracking.cpp.
References assert(), llvm::Lower, and llvm::Upper.
Referenced by isKnownNonZero().
|
static |
Definition at line 100 of file ValueTracking.cpp.
References llvm::Instruction::getParent().
Referenced by llvm::analyzeKnownBitsFromAndXorOr(), llvm::computeKnownBits(), llvm::computeKnownFPClass(), llvm::ComputeNumSignBits(), llvm::isKnownNonEqual(), llvm::isKnownNonZero(), llvm::isKnownToBeAPowerOfTwo(), and llvm::MaskedValueIsZero().
|
static |
Definition at line 114 of file ValueTracking.cpp.
References llvm::Instruction::getParent().
|
static |
Definition at line 8789 of file ValueTracking.cpp.
References llvm::BitWidth, I, llvm::Lower, and llvm::Upper.
Referenced by llvm::computeConstantRange().
|
static |
Definition at line 8465 of file ValueTracking.cpp.
References llvm::APInt::ashr(), assert(), llvm::CallingConv::C, llvm::APInt::getAllOnes(), llvm::APInt::getMaxValue(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), llvm::Instruction::hasNoSignedWrap(), llvm::InstrInfoQuery::hasNoSignedWrap(), llvm::InstrInfoQuery::hasNoUnsignedWrap(), llvm::InstrInfoQuery::isExact(), llvm::Lower, llvm::APInt::lshr(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::match(), llvm::APInt::sdiv(), std::swap(), llvm::APInt::udiv(), and llvm::Upper.
Referenced by llvm::computeConstantRange().
|
static |
Definition at line 8736 of file ValueTracking.cpp.
References llvm::BitWidth, llvm::CallingConv::C, llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), llvm::APInt::getZero(), llvm::InstrInfoQuery::hasNoSignedWrap(), LHS, llvm::Lower, llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_Neg(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::match(), llvm::matchSelectPattern(), RHS, llvm::SPF_ABS, llvm::SPF_NABS, llvm::SPF_SMAX, llvm::SPF_SMIN, llvm::SPF_UMAX, llvm::SPF_UMIN, llvm::SPF_UNKNOWN, and llvm::Upper.
Referenced by llvm::computeConstantRange().
Shifts return poison if shiftwidth is larger than the bitwidth.
Definition at line 6519 of file ValueTracking.cpp.
References llvm::all_of(), llvm::CallingConv::C, and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by canCreateUndefOrPoison().
|
static |
Referenced by isKnownNonNullFromDominatingCondition().