LLVM
10.0.0svn
|
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.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/AssumptionCache.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/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CallSite.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/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/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 <array>
#include <cassert>
#include <cstdint>
#include <iterator>
#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. More... | |
static const Instruction * | safeCxtI (const Value *V, const Instruction *CxtI) |
static void | computeKnownBits (const Value *V, KnownBits &Known, unsigned Depth, const Query &Q) |
Determine which bits of V are known to be either zero or one and return them in the Known bit set. More... | |
static KnownBits | computeKnownBits (const Value *V, unsigned Depth, const Query &Q) |
Determine which bits of V are known to be either zero or one and return them. More... | |
static bool | isKnownToBeAPowerOfTwo (const Value *V, bool OrZero, unsigned Depth, const Query &Q) |
Return true if the given value is known to have exactly one bit set when defined. More... | |
static bool | isKnownNonZero (const Value *V, unsigned Depth, const Query &Q) |
Return true if the given value is known to be non-zero when defined. More... | |
static bool | isKnownNonEqual (const Value *V1, const Value *V2, const Query &Q) |
Return true if it is known that V1 != V2. More... | |
static bool | MaskedValueIsZero (const Value *V, const APInt &Mask, unsigned Depth, const Query &Q) |
Return true if 'V & Mask' is known to be zero. More... | |
static unsigned | ComputeNumSignBits (const Value *V, unsigned Depth, const Query &Q) |
static void | computeKnownBitsAddSub (bool Add, const Value *Op0, const Value *Op1, bool NSW, KnownBits &KnownOut, KnownBits &Known2, unsigned Depth, const Query &Q) |
static void | computeKnownBitsMul (const Value *Op0, const Value *Op1, bool NSW, KnownBits &Known, KnownBits &Known2, unsigned Depth, const Query &Q) |
static bool | isEphemeralValueOf (const Instruction *I, const Value *E) |
static void | computeKnownBitsFromAssume (const Value *V, KnownBits &Known, unsigned Depth, const Query &Q) |
static void | computeKnownBitsFromShiftOperator (const Operator *I, KnownBits &Known, KnownBits &Known2, unsigned Depth, const Query &Q, function_ref< APInt(const APInt &, unsigned)> KZF, function_ref< APInt(const APInt &, unsigned)> KOF) |
Compute known bits from a shift operator, including those with a non-constant shift amount. More... | |
static void | computeKnownBitsFromOperator (const Operator *I, KnownBits &Known, unsigned Depth, const Query &Q) |
static bool | isGEPKnownNonNull (const GEPOperator *GEP, unsigned Depth, const Query &Q) |
Test whether a GEP's result is known to be non-null. More... | |
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. More... | |
static bool | isAddOfNonZero (const Value *V1, const Value *V2, const Query &Q) |
Return true if V2 == V1 + X, where X is known non-zero. More... | |
static bool | isSignedMinMaxClamp (const Value *Select, const Value *&In, const APInt *&CLow, const APInt *&CHigh) |
static unsigned | computeNumSignBitsVectorConstant (const Value *V, unsigned TyBits) |
For vector constants, loop over the elements and find the constant with the minimum number of sign bits. More... | |
static unsigned | ComputeNumSignBitsImpl (const Value *V, unsigned Depth, const Query &Q) |
Return the number of times the sign bit of the register is replicated into the other bits. More... | |
static bool | cannotBeOrderedLessThanZeroImpl (const Value *V, const TargetLibraryInfo *TLI, bool SignBitOnly, unsigned Depth) |
If SignBitOnly is true, test for a known 0 sign bit rather than a standard ordered compare. More... | |
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'. More... | |
static bool | isSameUnderlyingObjectInLoop (const PHINode *PN, const LoopInfo *LI) |
PN defines a loop-variant pointer to an object. More... | |
static const Value * | getUnderlyingObjectFromInt (const Value *V) |
This is the function that does the work of looking through basic ptrtoint+arithmetic+inttoptr sequences. More... | |
static OverflowResult | mapOverflowResult (ConstantRange::OverflowResult OR) |
Convert ConstantRange OverflowResult into ValueTracking OverflowResult. More... | |
static ConstantRange | computeConstantRangeIncludingKnownBits (const Value *V, bool ForSigned, const DataLayout &DL, unsigned Depth, AssumptionCache *AC, const Instruction *CxtI, const DominatorTree *DT, OptimizationRemarkEmitter *ORE=nullptr, bool UseInstrInfo=true) |
Combine constant ranges from computeConstantRange() and computeKnownBits(). More... | |
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 | 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. More... | |
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))) More... | |
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)) More... | |
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. More... | |
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. More... | |
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. More... | |
static 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. More... | |
static bool | isMatchingOps (const Value *ALHS, const Value *ARHS, const Value *BLHS, const Value *BRHS, bool &IsSwappedOps) |
Return true if the operands of the two compares match. More... | |
static Optional< bool > | isImpliedCondMatchingOperands (CmpInst::Predicate APred, CmpInst::Predicate BPred, bool AreSwappedOps) |
Return true if "icmp1 APred X, Y" implies "icmp2 BPred X, Y" is true. More... | |
static Optional< bool > | isImpliedCondMatchingImmOperands (CmpInst::Predicate APred, const ConstantInt *C1, CmpInst::Predicate BPred, const ConstantInt *C2) |
Return true if "icmp APred X, C1" implies "icmp BPred X, C2" is true. More... | |
static Optional< bool > | isImpliedCondICmps (const ICmpInst *LHS, const ICmpInst *RHS, const DataLayout &DL, bool LHSIsTrue, unsigned Depth) |
Return true if LHS implies RHS is true. More... | |
static Optional< bool > | isImpliedCondAndOr (const BinaryOperator *LHS, const ICmpInst *RHS, const DataLayout &DL, bool LHSIsTrue, unsigned Depth) |
Return true if LHS implies RHS is true. More... | |
static void | setLimitsForBinOp (const BinaryOperator &BO, APInt &Lower, APInt &Upper, const InstrInfoQuery &IIQ) |
static void | setLimitsForIntrinsic (const IntrinsicInst &II, APInt &Lower, APInt &Upper) |
static void | setLimitsForSelectPattern (const SelectInst &SI, APInt &Lower, APInt &Upper, const InstrInfoQuery &IIQ) |
static Optional< int64_t > | getOffsetFromIndex (const GEPOperator *GEP, unsigned Idx, const DataLayout &DL) |
Variables | |
const unsigned | MaxDepth = 6 |
static cl::opt< unsigned > | DomConditionsMaxUses ("dom-conditions-max-uses", cl::Hidden, cl::init(20)) |
|
static |
Definition at line 3292 of file ValueTracking.cpp.
References llvm::InsertValueInst::Create(), llvm::dyn_cast(), llvm::numbers::e, llvm::Instruction::eraseFromParent(), llvm::FindInsertedValue(), llvm::InsertValueInst::getAggregateOperand(), llvm::StructType::getElementType(), llvm::StructType::getNumElements(), llvm::makeArrayRef(), llvm::SmallVectorTemplateBase< T, bool >::pop_back(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by BuildSubAggregate(), and llvm::FindInsertedValue().
|
static |
Definition at line 3351 of file ValueTracking.cpp.
References assert(), llvm::ArrayRef< T >::begin(), BuildSubAggregate(), llvm::ArrayRef< T >::end(), llvm::UndefValue::get(), llvm::ExtractValueInst::getIndexedType(), llvm::Value::getType(), and llvm::SmallVectorBase::size().
|
static |
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 2942 of file ValueTracking.cpp.
References llvm::MCID::Call, llvm::CannotBeNegativeZero(), llvm::dyn_cast(), llvm::Exponent, llvm::getIntrinsicForCallSite(), llvm::Operator::getOpcode(), llvm::User::getOperand(), I, llvm::isKnownNeverNaN(), LLVM_FALLTHROUGH, llvm::maximum(), llvm::maxnum(), llvm::minimum(), llvm::minnum(), and llvm::MCID::Select.
Referenced by llvm::CannotBeOrderedLessThanZero(), and llvm::SignBitMustBeZero().
|
static |
Combine constant ranges from computeConstantRange() and computeKnownBits().
Definition at line 3998 of file ValueTracking.cpp.
References llvm::computeConstantRange(), llvm::computeKnownBits(), 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 elements in the vector.
Definition at line 1634 of file ValueTracking.cpp.
References assert(), C, llvm::computeKnownBits(), computeKnownBitsFromAssume(), computeKnownBitsFromOperator(), llvm::countTrailingZeros(), llvm::numbers::e, llvm::Constant::getAggregateElement(), llvm::KnownBits::getBitWidth(), llvm::Value::getPointerAlignment(), llvm::Type::getScalarType(), llvm::Value::getType(), llvm::Type::isIntOrIntVectorTy(), llvm::Type::isPointerTy(), llvm::Type::isPtrOrPtrVectorTy(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::match(), llvm::KnownBits::One, llvm::KnownBits::resetAll(), llvm::APInt::setAllBits(), llvm::KnownBits::setAllZero(), llvm::APInt::setLowBits(), and llvm::KnownBits::Zero.
Referenced by llvm::computeKnownBits().
Determine which bits of V are known to be either zero or one and return them.
Definition at line 1613 of file ValueTracking.cpp.
References llvm::computeKnownBits(), getBitWidth(), and llvm::Value::getType().
|
static |
Definition at line 307 of file ValueTracking.cpp.
References llvm::KnownBits::computeForAddSub(), llvm::computeKnownBits(), and llvm::KnownBits::getBitWidth().
Referenced by computeKnownBitsFromOperator().
|
static |
Definition at line 578 of file ValueTracking.cpp.
References Arg, assert(), B, C, llvm::computeKnownBits(), llvm::KnownBits::countMinLeadingZeros(), llvm::dyn_cast(), llvm::CallBase::getArgOperand(), llvm::KnownBits::getBitWidth(), llvm::CallBase::getCalledFunction(), llvm::Function::getIntrinsicID(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::CmpInst::getPredicate(), I, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, llvm::APInt::intersects(), llvm::KnownBits::isAllOnes(), llvm::isKnownToBeAPowerOfTwo(), llvm::KnownBits::isNegative(), llvm::KnownBits::isNonNegative(), llvm::isValidAssumeForContext(), llvm::KnownBits::isZero(), llvm::APInt::lshrInPlace(), 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_PtrToInt(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Shr(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::KnownBits::makeNegative(), llvm::KnownBits::makeNonNegative(), llvm::PatternMatch::match(), llvm::KnownBits::One, llvm::KnownBits::resetAll(), llvm::APInt::setAllBits(), llvm::KnownBits::setAllOnes(), llvm::KnownBits::setAllZero(), llvm::APInt::setHighBits(), and llvm::KnownBits::Zero.
Referenced by computeKnownBits(), and computeOverflowForSignedAdd().
|
static |
Definition at line 978 of file ValueTracking.cpp.
References llvm::MCID::Add, llvm::APInt::ashr(), assert(), llvm::APInt::byteSwap(), llvm::MCID::Call, llvm::KnownBits::computeForAddSub(), llvm::computeKnownBits(), computeKnownBitsAddSub(), llvm::computeKnownBitsFromRangeMetadata(), computeKnownBitsFromShiftOperator(), computeKnownBitsMul(), llvm::APInt::countLeadingZeros(), llvm::KnownBits::countMaxLeadingZeros(), llvm::KnownBits::countMaxPopulation(), llvm::KnownBits::countMinLeadingOnes(), llvm::KnownBits::countMinLeadingZeros(), llvm::KnownBits::countMinTrailingOnes(), llvm::KnownBits::countMinTrailingZeros(), llvm::countTrailingZeros(), llvm::APInt::countTrailingZeros(), llvm::Depth, llvm::dyn_cast(), llvm::numbers::e, llvm::SelectPatternResult::Flavor, llvm::gep_type_begin(), llvm::AllocaInst::getAlignment(), llvm::AllocaInst::getAllocatedType(), llvm::KnownBits::getBitWidth(), llvm::StructLayout::getElementOffset(), llvm::PHINode::getIncomingValue(), llvm::generic_gep_type_iterator< ItTy >::getIndexedType(), llvm::ExtractValueInst::getIndices(), llvm::PHINode::getNumIncomingValues(), llvm::ExtractValueInst::getNumIndices(), llvm::User::getNumOperands(), llvm::Operator::getOpcode(), llvm::User::getOperand(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, CallBrTy, IterTy >::getReturnedArgOperand(), llvm::Type::getScalarSizeInBits(), llvm::Type::getScalarType(), llvm::Constant::getSplatValue(), llvm::generic_gep_type_iterator< ItTy >::getStructTypeOrNull(), llvm::ConstantInt::getTrue(), llvm::Value::getType(), llvm::PHINode::hasConstantValue(), I, if(), llvm::PHINode::incoming_values(), llvm::APInt::intersects(), llvm::Type::isIntOrPtrTy(), llvm::SelectPatternResult::isMinOrMax(), llvm::KnownBits::isNegative(), llvm::KnownBits::isNonNegative(), llvm::Type::isPointerTy(), llvm::APInt::isPowerOf2(), llvm::APInt::isSignBitSet(), llvm::Type::isSized(), llvm::APInt::isSubsetOf(), llvm::Type::isVectorTy(), llvm::Constant::isZeroValue(), LLVM_FALLTHROUGH, llvm::SPII::Load, llvm::Log2_32(), llvm::APInt::lshr(), llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_c_BinOp(), llvm::PatternMatch::m_Deferred(), llvm::PatternMatch::m_Neg(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::KnownBits::makeNegative(), llvm::KnownBits::makeNonNegative(), llvm::PatternMatch::match(), llvm::matchSelectPattern(), llvm::max(), llvm::KnownBits::One, P, RA, llvm::KnownBits::resetAll(), llvm::APInt::reverseBits(), llvm::MCID::Select, llvm::APInt::setAllBits(), llvm::APInt::setBit(), llvm::APInt::setBitsFrom(), llvm::APInt::setHighBits(), llvm::APInt::setLowBits(), llvm::APInt::setSignBit(), llvm::KnownBits::sext(), llvm::APInt::shl(), llvm::SPF_ABS, llvm::SPF_SMAX, llvm::SPF_SMIN, llvm::SPF_UMAX, llvm::SPF_UMIN, llvm::KnownBits::trunc(), llvm::APInt::urem(), X, Y, 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. KZF and KOF are operator-specific functions that, given the known-zero or known-one bits respectively, and a shift amount, compute the implied known-zero or known-one bits of the shift operator's result respectively for that shift amount. The results from calling KZF and KOF are conservatively combined for all permitted shift amounts.
Definition at line 891 of file ValueTracking.cpp.
References llvm::computeKnownBits(), llvm::KnownBits::getBitWidth(), llvm::User::getOperand(), llvm::APInt::getZExtValue(), llvm::KnownBits::hasConflict(), llvm::Optional< T >::hasValue(), llvm::isKnownNonZero(), llvm::KnownBits::One, llvm::PowerOf2Ceil(), llvm::KnownBits::resetAll(), llvm::APInt::setAllBits(), llvm::KnownBits::setAllZero(), llvm::KnownBits::Zero, and llvm::APInt::zextOrTrunc().
Referenced by computeKnownBitsFromOperator().
|
static |
Definition at line 322 of file ValueTracking.cpp.
References assert(), llvm::computeKnownBits(), llvm::KnownBits::countMinLeadingZeros(), llvm::KnownBits::countMinTrailingZeros(), llvm::countTrailingOnes(), llvm::KnownBits::getBitWidth(), llvm::APInt::getLoBits(), llvm::KnownBits::hasConflict(), llvm::isKnownNegative(), llvm::isKnownNonNegative(), llvm::isKnownNonZero(), llvm::KnownBits::isNegative(), llvm::KnownBits::isNonNegative(), llvm::KnownBits::makeNegative(), llvm::KnownBits::makeNonNegative(), llvm::max(), llvm::KnownBits::One, llvm::KnownBits::resetAll(), llvm::APInt::setHighBits(), and llvm::KnownBits::Zero.
Referenced by computeKnownBitsFromOperator().
Definition at line 2360 of file ValueTracking.cpp.
References assert(), and ComputeNumSignBitsImpl().
Referenced by llvm::ComputeNumSignBits().
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.
Definition at line 2373 of file ValueTracking.cpp.
References llvm::MCID::Add, assert(), llvm::APInt::ceilLogBase2(), llvm::computeKnownBits(), llvm::ComputeNumSignBits(), computeNumSignBitsVectorConstant(), llvm::KnownBits::countMinSignBits(), llvm::numbers::e, llvm::PHINode::getIncomingValue(), llvm::PHINode::getNumIncomingValues(), llvm::APInt::getNumSignBits(), llvm::Operator::getOpcode(), getScalarSizeInBits(), llvm::Type::getScalarType(), getType(), llvm::Value::getType(), llvm::APInt::getZExtValue(), llvm::KnownBits::isNonNegative(), llvm::Type::isPointerTy(), isSignedMinMaxClamp(), llvm::APInt::isStrictlyPositive(), llvm::APInt::logBase2(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::match(), llvm::max(), llvm::MCID::Select, llvm::APInt::setBit(), llvm::APInt::uge(), X, and llvm::KnownBits::Zero.
Referenced by ComputeNumSignBits(), and computeNumSignBitsVectorConstant().
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 2337 of file ValueTracking.cpp.
References ComputeNumSignBitsImpl(), and llvm::dyn_cast().
Referenced by ComputeNumSignBitsImpl().
|
static |
Definition at line 4080 of file ValueTracking.cpp.
References computeConstantRangeIncludingKnownBits(), computeKnownBitsFromAssume(), llvm::ComputeNumSignBits(), llvm::ConstantRange::getBitWidth(), llvm::OverflowingBinaryOperator::hasNoSignedWrap(), llvm::ConstantRange::isAllNegative(), llvm::ConstantRange::isAllNonNegative(), mapOverflowResult(), llvm::MayOverflow, llvm::NeverOverflows, OR, and llvm::ConstantRange::signedAddMayOverflow().
Referenced by llvm::computeOverflowForSignedAdd().
|
static |
Returns the bitwidth of the given scalar or pointer type.
For vector types, returns the element type's bitwidth.
Definition at line 87 of file ValueTracking.cpp.
References assert(), llvm::DataLayout::getIndexTypeSizeInBits(), and llvm::Type::getScalarSizeInBits().
Referenced by llvm::ARMTargetLowering::canCombineStoreAndExtract(), canConvertValue(), llvm::cannotBeMaxInLoop(), llvm::cannotBeMinInLoop(), llvm::FunctionComparator::cmpTypes(), collectBitParts(), computeKnownBits(), llvm::ConstantFoldCastInstruction(), llvm::createSeparateConstOffsetFromGEPPass(), DecodeFixedType(), llvm::NVPTXAsmPrinter::doFinalization(), ExtractConstantBytes(), foldICmpWithMinMax(), getAttrKindEncoding(), llvm::ExecutionEngine::getConstantValue(), llvm::EVT::getEVT(), getMangledTypeStr(), llvm::IntegerType::getMask(), getNoopInput(), getOpenCLAlignment(), llvm::Type::getPrimitiveSizeInBits(), llvm::NVPTXTargetLowering::getPrototype(), getRangeForAffineARHelper(), llvm::SCEVExpander::getRelatedExistingExpansion(), llvm::MVT::getVT(), getX86MaskVec(), INITIALIZE_PASS(), isGEPFoldable(), IsIncrementNSW(), IsIncrementNUW(), llvm::Type::isIntegerTy(), isKnownNonZero(), IsNonLocalValue(), llvm::IntegerType::isPowerOf2ByteWidth(), isSupportedType(), LLVMCreateGenericValueOfInt(), LLVMGetIntTypeWidth(), llvm::ExecutionEngine::LoadValueFromMemory(), MatchBinaryOp(), memVTFromAggregate(), llvm::APInt::operator[](), PrintLLVMName(), llvm::MCJIT::runFunction(), llvm::orc::OrcMCJITReplacement::runFunction(), shouldMergeGEPs(), UnpackFromArgumentSlot(), llvm::UnrollRuntimeLoopRemainder(), UpgradeMaskedLoad(), UpgradeMaskedStore(), llvm::sroa::AllocaSliceRewriter::visit(), llvm::Interpreter::visitAllocaInst(), and llvm::Interpreter::visitAShr().
|
static |
Definition at line 5715 of file ValueTracking.cpp.
References llvm::dyn_cast(), llvm::numbers::e, llvm::gep_type_begin(), llvm::StructLayout::getElementOffset(), llvm::generic_gep_type_iterator< ItTy >::getIndexedType(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::ConstantInt::getSExtValue(), llvm::DataLayout::getStructLayout(), llvm::generic_gep_type_iterator< ItTy >::getStructTypeOrNull(), llvm::DataLayout::getTypeAllocSize(), llvm::ConstantInt::getZExtValue(), llvm::ConstantInt::isZero(), llvm::None, and Size.
Referenced by llvm::isPointerOffset().
|
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 3591 of file ValueTracking.cpp.
References llvm::ConstantDataArraySlice::Array, E, llvm::getConstantDataArrayInfo(), llvm::ConstantDataSequential::getElementAsInteger(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::ConstantDataArraySlice::Length, llvm::ConstantDataArraySlice::Offset, SI, and llvm::Value::stripPointerCasts().
Referenced by llvm::GetStringLength().
This is the function that does the work of looking through basic ptrtoint+arithmetic+inttoptr sequences.
Definition at line 3807 of file ValueTracking.cpp.
References llvm::MCID::Add, assert(), llvm::Operator::getOpcode(), llvm::Value::getType(), and llvm::Type::isIntegerTy().
Referenced by llvm::getUnderlyingObjectsForCodeGen().
Return true if V2 == V1 + X, where X is known non-zero.
Definition at line 2249 of file ValueTracking.cpp.
References llvm::MCID::Add, llvm::dyn_cast(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), and llvm::isKnownNonZero().
Referenced by isKnownNonEqual().
|
static |
Definition at line 464 of file ValueTracking.cpp.
References llvm::all_of(), llvm::SmallPtrSetImpl< PtrType >::count(), E, llvm::SmallVectorBase::empty(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::is_contained(), llvm::isSafeToSpeculativelyExecute(), llvm::User::operands(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T >::push_back(), and llvm::Value::users().
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 1841 of file ValueTracking.cpp.
References assert(), llvm::Depth, F(), llvm::gep_type_begin(), llvm::gep_type_end(), llvm::StructLayout::getElementOffset(), llvm::GEPOperator::getPointerAddressSpace(), llvm::GEPOperator::getPointerOperand(), llvm::Value::getType(), llvm::ConstantInt::getZExtValue(), llvm::GEPOperator::isInBounds(), llvm::isKnownNonZero(), llvm::Type::isPointerTy(), and llvm::NullPointerIsDefined().
Referenced by isKnownNonZero().
|
static |
Return true if LHS implies RHS is true.
Return false if LHS implies RHS is false. Otherwise, return None if we can't infer anything. We expect the RHS to be an icmp and the LHS to be an 'and' or an 'or' instruction.
Definition at line 5315 of file ValueTracking.cpp.
References assert(), llvm::BinaryOperator::getOpcode(), llvm::isImpliedCondition(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), and llvm::None.
Referenced by llvm::isImpliedCondition().
|
static |
Return true if LHS implies RHS is true.
Return false if LHS implies RHS is false. Otherwise, return None if we can't infer anything.
Definition at line 5270 of file ValueTracking.cpp.
References llvm::ARCCC::BRHS, llvm::CmpInst::getInversePredicate(), llvm::User::getOperand(), llvm::CmpInst::getPredicate(), isImpliedCondMatchingImmOperands(), isImpliedCondMatchingOperands(), isImpliedCondOperands(), isMatchingOps(), and llvm::None.
Referenced by llvm::isImpliedCondition().
|
static |
Return true if "icmp APred X, C1" implies "icmp BPred X, C2" is true.
Return false if "icmp APred X, C1" implies "icmp BPred X, C2" is false. Otherwise, return None if we can't infer anything.
Definition at line 5251 of file ValueTracking.cpp.
References llvm::ConstantRange::difference(), llvm::ConstantInt::getValue(), llvm::ConstantRange::intersectWith(), llvm::ConstantRange::isEmptySet(), llvm::ConstantRange::makeAllowedICmpRegion(), llvm::ConstantRange::makeExactICmpRegion(), and llvm::None.
Referenced by isImpliedCondICmps().
|
static |
Return true if "icmp1 APred X, Y" implies "icmp2 BPred X, Y" is true.
Return false if "icmp1 APred X, Y" implies "icmp2 BPred X, Y" is false. Otherwise, return None if we can't infer anything.
Definition at line 5232 of file ValueTracking.cpp.
References llvm::CmpInst::getSwappedPredicate(), llvm::CmpInst::isImpliedFalseByMatchingCmp(), llvm::CmpInst::isImpliedTrueByMatchingCmp(), and llvm::None.
Referenced by isImpliedCondICmps().
|
static |
Return true if "icmp Pred BLHS BRHS" is true whenever "icmp Pred ALHS ARHS" is true.
Otherwise, return None.
Definition at line 5195 of file ValueTracking.cpp.
References llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, isTruePredicate(), and llvm::None.
Referenced by isImpliedCondICmps(), and llvm::ScalarEvolution::isLoopEntryGuardedByCond().
Return true if it is known that V1 != V2.
Definition at line 2264 of file ValueTracking.cpp.
References llvm::computeKnownBits(), llvm::Value::getType(), llvm::APInt::intersects(), isAddOfNonZero(), llvm::Type::isIntOrIntVectorTy(), llvm::KnownBits::One, and llvm::KnownBits::Zero.
Referenced by llvm::isKnownNonEqual().
|
static |
Definition at line 4442 of file ValueTracking.cpp.
References C, E, I, and llvm::FastMathFlags::noNaNs().
Referenced by matchSelectPattern().
|
static |
Definition at line 1902 of file ValueTracking.cpp.
References Arg, assert(), DomConditionsMaxUses, llvm::DominatorTree::dominates(), llvm::SmallVectorBase::empty(), llvm::Instruction::getParent(), llvm::Value::getType(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::isGuard(), llvm::Type::isPointerTy(), llvm::PatternMatch::m_c_ICmp(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Zero(), llvm::PatternMatch::match(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T >::push_back(), and llvm::Value::users().
Referenced by isKnownNonZero().
Return true if the given value is known to be non-zero when defined.
For vectors, return true if every 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 2000 of file ValueTracking.cpp.
References C, llvm::computeKnownBits(), llvm::KnownBits::countMaxLeadingZeros(), llvm::KnownBits::countMinTrailingZeros(), llvm::Depth, llvm::numbers::e, GEP, llvm::getArgumentAliasingToReturnedPointer(), getBitWidth(), llvm::Type::getScalarType(), llvm::APInt::getSignedMaxValue(), llvm::Value::getType(), llvm::APInt::intersects(), llvm::PossiblyExactOperator::isExact(), isGEPKnownNonNull(), isKnownNonNullFromDominatingCondition(), llvm::isKnownNonZero(), llvm::isKnownToBeAPowerOfTwo(), llvm::KnownBits::isNegative(), llvm::KnownBits::isNonNegative(), llvm::Constant::isNullValue(), llvm::Type::isPointerTy(), llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_Exact(), llvm::PatternMatch::m_IDiv(), llvm::PatternMatch::m_Mul(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Shr(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::KnownBits::One, rangeMetadataExcludesValue(), llvm::NVPTX::PTXCvtMode::RP, SI, X, and Y.
Referenced by llvm::isKnownNonZero().
Definition at line 4462 of file ValueTracking.cpp.
|
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 1742 of file ValueTracking.cpp.
References assert(), llvm::computeKnownBits(), llvm::Depth, llvm::APInt::getBoolValue(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::isKnownToBeAPowerOfTwo(), llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_Exact(), 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_UDiv(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::KnownBits::One, SI, X, Y, and llvm::KnownBits::Zero.
Referenced by llvm::isKnownToBeAPowerOfTwo().
|
static |
Return true if the operands of the two compares match.
IsSwappedOps is true when the operands match, but are swapped.
Definition at line 5220 of file ValueTracking.cpp.
References llvm::ARCCC::BRHS.
Referenced by isImpliedCondICmps().
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 3689 of file ValueTracking.cpp.
References llvm::dyn_cast(), llvm::PHINode::getIncomingValue(), llvm::LoopInfoBase< BlockT, LoopT >::getLoopFor(), llvm::PHINode::getNumIncomingValues(), llvm::Instruction::getParent(), llvm::Loop::isLoopInvariant(), and llvm::SPII::Load.
Referenced by llvm::GetUnderlyingObjects().
|
static |
Definition at line 2304 of file ValueTracking.cpp.
References assert(), llvm::SelectPatternResult::Flavor, llvm::getInverseMinMaxFlavor(), getOpcode(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::match(), llvm::matchSelectPattern(), llvm::MCID::Select, llvm::APInt::sle(), llvm::SPF_SMAX, llvm::SPF_SMIN, and std::swap().
Referenced by ComputeNumSignBitsImpl().
|
static |
Return true if "icmp Pred LHS RHS" is always true.
Definition at line 5134 of file ValueTracking.cpp.
References assert(), B, C, llvm::computeKnownBits(), llvm::Value::getType(), llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_ULE, llvm::APInt::isNegative(), llvm::CmpInst::isTrueWhenEqual(), llvm::Type::isVectorTy(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_NSWAdd(), llvm::PatternMatch::m_NUWAdd(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), 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 4958 of file ValueTracking.cpp.
References C, llvm::dyn_cast(), llvm::ConstantExpr::getCast(), llvm::ConstantExpr::getFPExtend(), llvm::ConstantExpr::getFPToSI(), llvm::ConstantExpr::getFPToUI(), llvm::ConstantExpr::getFPTrunc(), llvm::ConstantExpr::getIntegerCast(), llvm::CastInst::getOpcode(), 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(), llvm::PatternMatch::match(), and llvm::NVPTX::PTXLdStInstCode::V2.
Referenced by llvm::matchDecomposedSelectPattern().
|
static |
Convert ConstantRange OverflowResult into ValueTracking OverflowResult.
Definition at line 3983 of file ValueTracking.cpp.
References llvm::ConstantRange::AlwaysOverflowsHigh, llvm::AlwaysOverflowsHigh, llvm::ConstantRange::AlwaysOverflowsLow, llvm::AlwaysOverflowsLow, llvm_unreachable, llvm::ConstantRange::MayOverflow, llvm::MayOverflow, llvm::ConstantRange::NeverOverflows, and llvm::NeverOverflows.
Referenced by computeOverflowForSignedAdd(), llvm::computeOverflowForSignedSub(), llvm::computeOverflowForUnsignedAdd(), llvm::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 2295 of file ValueTracking.cpp.
References llvm::computeKnownBits(), llvm::APInt::getBitWidth(), llvm::APInt::isSubsetOf(), and llvm::KnownBits::Zero.
Referenced by llvm::MaskedValueIsZero().
|
static |
Recognize variations of: CLAMP(v,l,h) ==> ((v) < (l) ? (l) : ((v) > (h) ? (h) : (v)))
Definition at line 4537 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 4483 of file ValueTracking.cpp.
References llvm::APFloat::compare(), 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(), 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(), 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 4667 of file ValueTracking.cpp.
References llvm::SelectPatternResult::Flavor, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLT, llvm::APInt::isAllOnesValue(), llvm::APInt::isMaxSignedValue(), llvm::APInt::isMinSignedValue(), llvm::APInt::isNullValue(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_NSWSub(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Zero(), llvm::PatternMatch::match(), matchClamp(), matchMinMaxOfMinMax(), 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 4573 of file ValueTracking.cpp.
References assert(), B, C, D, llvm::SelectPatternResult::Flavor, 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 4761 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::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(), 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(), 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 llvm::matchDecomposedSelectPattern().
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 1979 of file ValueTracking.cpp.
References assert(), llvm::MDNode::getNumOperands(), llvm::MDNode::getOperand(), llvm::ConstantInt::getValue(), and llvm::Upper.
Referenced by isKnownNonZero().
|
static |
Definition at line 150 of file ValueTracking.cpp.
References llvm::computeKnownBits(), llvm::Depth, llvm::dyn_cast(), and llvm::Instruction::getParent().
Referenced by llvm::computeKnownBits(), llvm::ComputeNumSignBits(), llvm::isKnownNonEqual(), llvm::isKnownNonZero(), llvm::isKnownToBeAPowerOfTwo(), and llvm::MaskedValueIsZero().
|
static |
Definition at line 5418 of file ValueTracking.cpp.
References llvm::APInt::abs(), llvm::MCID::Add, llvm::APInt::ashr(), assert(), C, llvm::APInt::countLeadingOnes(), llvm::APInt::countLeadingZeros(), llvm::APInt::countTrailingZeros(), llvm::APInt::getAllOnesValue(), llvm::APInt::getBitWidth(), llvm::APInt::getMaxValue(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), llvm::InstrInfoQuery::hasNoSignedWrap(), llvm::Instruction::hasNoSignedWrap(), llvm::InstrInfoQuery::hasNoUnsignedWrap(), llvm::APInt::isAllOnesValue(), llvm::InstrInfoQuery::isExact(), llvm::APInt::isMinSignedValue(), llvm::APInt::isNegative(), llvm::APInt::isNullValue(), llvm::APInt::lshr(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::match(), llvm::APInt::sdiv(), llvm::APInt::sgt(), llvm::APInt::shl(), std::swap(), llvm::APInt::udiv(), and llvm::APInt::ult().
Referenced by llvm::computeConstantRange().
|
static |
Definition at line 5573 of file ValueTracking.cpp.
References C, llvm::APInt::getBitWidth(), llvm::IntrinsicInst::getIntrinsicID(), llvm::APInt::getMaxValue(), llvm::User::getOperand(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), llvm::APInt::isNegative(), llvm::PatternMatch::m_APInt(), and llvm::PatternMatch::match().
Referenced by llvm::computeConstantRange().
|
static |
Definition at line 5634 of file ValueTracking.cpp.
References C, llvm::SelectPatternResult::Flavor, llvm::APInt::getNullValue(), llvm::Type::getScalarSizeInBits(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), llvm::Value::getType(), llvm::InstrInfoQuery::hasNoSignedWrap(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_Neg(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::match(), llvm::matchSelectPattern(), llvm::SPF_ABS, llvm::SPF_NABS, llvm::SPF_SMAX, llvm::SPF_SMIN, llvm::SPF_UMAX, llvm::SPF_UMIN, and llvm::SPF_UNKNOWN.
Referenced by llvm::computeConstantRange().
Referenced by isKnownNonNullFromDominatingCondition().
Definition at line 78 of file ValueTracking.cpp.
Referenced by adjCycles(), llvm::SUnit::biasCriticalPath(), getDepthOfOptCmov(), llvm::NodeSet::getMaxDepth(), llvm::NodeSet::print(), and propagateMetadata().