|
LLVM
3.7.0
|
ScalarEvolution - This class is the main scalar evolution driver. More...
#include <ScalarEvolution.h>
Public Types | |
| enum | LoopDisposition { LoopVariant, LoopInvariant, LoopComputable } |
| LoopDisposition - An enum describing the relationship between a SCEV and a loop. More... | |
| enum | BlockDisposition { DoesNotDominateBlock, DominatesBlock, ProperlyDominatesBlock } |
| BlockDisposition - An enum describing the relationship between a SCEV and a basic block. More... | |
Public Member Functions | |
| ScalarEvolution () | |
| LLVMContext & | getContext () const |
| bool | isSCEVable (Type *Ty) const |
| isSCEVable - Test if values of the given type are analyzable within the SCEV framework. More... | |
| uint64_t | getTypeSizeInBits (Type *Ty) const |
| getTypeSizeInBits - Return the size in bits of the specified type, for which isSCEVable must return true. More... | |
| Type * | getEffectiveSCEVType (Type *Ty) const |
| getEffectiveSCEVType - Return a type with the same bitwidth as the given type and which represents how SCEV will treat the given type, for which isSCEVable must return true. More... | |
| const SCEV * | getSCEV (Value *V) |
| getSCEV - Return a SCEV expression for the full generality of the specified expression. More... | |
| const SCEV * | getConstant (ConstantInt *V) |
| const SCEV * | getConstant (const APInt &Val) |
| const SCEV * | getConstant (Type *Ty, uint64_t V, bool isSigned=false) |
| const SCEV * | getTruncateExpr (const SCEV *Op, Type *Ty) |
| const SCEV * | getZeroExtendExpr (const SCEV *Op, Type *Ty) |
| const SCEV * | getSignExtendExpr (const SCEV *Op, Type *Ty) |
| const SCEV * | getAnyExtendExpr (const SCEV *Op, Type *Ty) |
| getAnyExtendExpr - Return a SCEV for the given operand extended with unspecified bits out to the given type. More... | |
| const SCEV * | getAddExpr (SmallVectorImpl< const SCEV * > &Ops, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap) |
| getAddExpr - Get a canonical add expression, or something simpler if possible. More... | |
| const SCEV * | getAddExpr (const SCEV *LHS, const SCEV *RHS, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap) |
| const SCEV * | getAddExpr (const SCEV *Op0, const SCEV *Op1, const SCEV *Op2, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap) |
| const SCEV * | getMulExpr (SmallVectorImpl< const SCEV * > &Ops, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap) |
| getMulExpr - Get a canonical multiply expression, or something simpler if possible. More... | |
| const SCEV * | getMulExpr (const SCEV *LHS, const SCEV *RHS, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap) |
| const SCEV * | getMulExpr (const SCEV *Op0, const SCEV *Op1, const SCEV *Op2, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap) |
| const SCEV * | getUDivExpr (const SCEV *LHS, const SCEV *RHS) |
| getUDivExpr - Get a canonical unsigned division expression, or something simpler if possible. More... | |
| const SCEV * | getUDivExactExpr (const SCEV *LHS, const SCEV *RHS) |
| getUDivExactExpr - Get a canonical unsigned division expression, or something simpler if possible. More... | |
| const SCEV * | getAddRecExpr (const SCEV *Start, const SCEV *Step, const Loop *L, SCEV::NoWrapFlags Flags) |
| getAddRecExpr - Get an add recurrence expression for the specified loop. More... | |
| const SCEV * | getAddRecExpr (SmallVectorImpl< const SCEV * > &Operands, const Loop *L, SCEV::NoWrapFlags Flags) |
| getAddRecExpr - Get an add recurrence expression for the specified loop. More... | |
| const SCEV * | getAddRecExpr (const SmallVectorImpl< const SCEV * > &Operands, const Loop *L, SCEV::NoWrapFlags Flags) |
| const SCEV * | getGEPExpr (Type *PointeeType, const SCEV *BaseExpr, const SmallVectorImpl< const SCEV * > &IndexExprs, bool InBounds=false) |
| Returns an expression for a GEP. More... | |
| const SCEV * | getSMaxExpr (const SCEV *LHS, const SCEV *RHS) |
| const SCEV * | getSMaxExpr (SmallVectorImpl< const SCEV * > &Operands) |
| const SCEV * | getUMaxExpr (const SCEV *LHS, const SCEV *RHS) |
| const SCEV * | getUMaxExpr (SmallVectorImpl< const SCEV * > &Operands) |
| const SCEV * | getSMinExpr (const SCEV *LHS, const SCEV *RHS) |
| const SCEV * | getUMinExpr (const SCEV *LHS, const SCEV *RHS) |
| const SCEV * | getUnknown (Value *V) |
| const SCEV * | getCouldNotCompute () |
| const SCEV * | getSizeOfExpr (Type *IntTy, Type *AllocTy) |
| getSizeOfExpr - Return an expression for sizeof AllocTy that is type IntTy More... | |
| const SCEV * | getOffsetOfExpr (Type *IntTy, StructType *STy, unsigned FieldNo) |
| getOffsetOfExpr - Return an expression for offsetof on the given field with type IntTy More... | |
| const SCEV * | getNegativeSCEV (const SCEV *V) |
| getNegativeSCEV - Return the SCEV object corresponding to -V. More... | |
| const SCEV * | getNotSCEV (const SCEV *V) |
| getNotSCEV - Return the SCEV object corresponding to ~V. More... | |
| const SCEV * | getMinusSCEV (const SCEV *LHS, const SCEV *RHS, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap) |
| getMinusSCEV - Return LHS-RHS. Minus is represented in SCEV as A+B*-1. More... | |
| const SCEV * | getTruncateOrZeroExtend (const SCEV *V, Type *Ty) |
| getTruncateOrZeroExtend - Return a SCEV corresponding to a conversion of the input value to the specified type. More... | |
| const SCEV * | getTruncateOrSignExtend (const SCEV *V, Type *Ty) |
| getTruncateOrSignExtend - Return a SCEV corresponding to a conversion of the input value to the specified type. More... | |
| const SCEV * | getNoopOrZeroExtend (const SCEV *V, Type *Ty) |
| getNoopOrZeroExtend - Return a SCEV corresponding to a conversion of the input value to the specified type. More... | |
| const SCEV * | getNoopOrSignExtend (const SCEV *V, Type *Ty) |
| getNoopOrSignExtend - Return a SCEV corresponding to a conversion of the input value to the specified type. More... | |
| const SCEV * | getNoopOrAnyExtend (const SCEV *V, Type *Ty) |
| getNoopOrAnyExtend - Return a SCEV corresponding to a conversion of the input value to the specified type. More... | |
| const SCEV * | getTruncateOrNoop (const SCEV *V, Type *Ty) |
| getTruncateOrNoop - Return a SCEV corresponding to a conversion of the input value to the specified type. More... | |
| const SCEV * | getUMaxFromMismatchedTypes (const SCEV *LHS, const SCEV *RHS) |
| getUMaxFromMismatchedTypes - Promote the operands to the wider of the types using zero-extension, and then perform a umax operation with them. More... | |
| const SCEV * | getUMinFromMismatchedTypes (const SCEV *LHS, const SCEV *RHS) |
| getUMinFromMismatchedTypes - Promote the operands to the wider of the types using zero-extension, and then perform a umin operation with them. More... | |
| const SCEV * | getPointerBase (const SCEV *V) |
| getPointerBase - Transitively follow the chain of pointer-type operands until reaching a SCEV that does not have a single pointer operand. More... | |
| const SCEV * | getSCEVAtScope (const SCEV *S, const Loop *L) |
| getSCEVAtScope - Return a SCEV expression for the specified value at the specified scope in the program. More... | |
| const SCEV * | getSCEVAtScope (Value *V, const Loop *L) |
| getSCEVAtScope - This is a convenience function which does getSCEVAtScope(getSCEV(V), L). More... | |
| bool | isLoopEntryGuardedByCond (const Loop *L, ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS) |
| isLoopEntryGuardedByCond - Test whether entry to the loop is protected by a conditional between LHS and RHS. More... | |
| bool | isLoopBackedgeGuardedByCond (const Loop *L, ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS) |
| isLoopBackedgeGuardedByCond - Test whether the backedge of the loop is protected by a conditional between LHS and RHS. More... | |
| unsigned | getSmallConstantTripCount (Loop *L) |
| Returns the maximum trip count of the loop if it is a single-exit loop and we can compute a small maximum for that loop. More... | |
| unsigned | getSmallConstantTripCount (Loop *L, BasicBlock *ExitingBlock) |
| getSmallConstantTripCount - Returns the maximum trip count of this loop as a normal unsigned value. More... | |
| unsigned | getSmallConstantTripMultiple (Loop *L) |
| Returns the largest constant divisor of the trip count of the loop if it is a single-exit loop and we can compute a small maximum for that loop. More... | |
| unsigned | getSmallConstantTripMultiple (Loop *L, BasicBlock *ExitingBlock) |
| getSmallConstantTripMultiple - Returns the largest constant divisor of the trip count of this loop as a normal unsigned value, if possible. More... | |
| const SCEV * | getExitCount (Loop *L, BasicBlock *ExitingBlock) |
| const SCEV * | getBackedgeTakenCount (const Loop *L) |
| getBackedgeTakenCount - If the specified loop has a predictable backedge-taken count, return it, otherwise return a SCEVCouldNotCompute object. More... | |
| const SCEV * | getMaxBackedgeTakenCount (const Loop *L) |
| getMaxBackedgeTakenCount - Similar to getBackedgeTakenCount, except return the least SCEV value that is known never to be less than the actual backedge taken count. More... | |
| bool | hasLoopInvariantBackedgeTakenCount (const Loop *L) |
| hasLoopInvariantBackedgeTakenCount - Return true if the specified loop has an analyzable loop-invariant backedge-taken count. More... | |
| void | forgetLoop (const Loop *L) |
| forgetLoop - This method should be called by the client when it has changed a loop in a way that may effect ScalarEvolution's ability to compute a trip count, or if the loop is deleted. More... | |
| void | forgetValue (Value *V) |
| forgetValue - This method should be called by the client when it has changed a value in a way that may effect its value, or which may disconnect it from a def-use chain linking it to a loop. More... | |
| void | forgetLoopDispositions (const Loop *L) |
| Called when the client has changed the disposition of values in this loop. More... | |
| uint32_t | GetMinTrailingZeros (const SCEV *S) |
| GetMinTrailingZeros - Determine the minimum number of zero bits that S is guaranteed to end in (at every loop iteration). More... | |
| ConstantRange | getUnsignedRange (const SCEV *S) |
| getUnsignedRange - Determine the unsigned range for a particular SCEV. More... | |
| ConstantRange | getSignedRange (const SCEV *S) |
| getSignedRange - Determine the signed range for a particular SCEV. More... | |
| bool | isKnownNegative (const SCEV *S) |
| isKnownNegative - Test if the given expression is known to be negative. More... | |
| bool | isKnownPositive (const SCEV *S) |
| isKnownPositive - Test if the given expression is known to be positive. More... | |
| bool | isKnownNonNegative (const SCEV *S) |
| isKnownNonNegative - Test if the given expression is known to be non-negative. More... | |
| bool | isKnownNonPositive (const SCEV *S) |
| isKnownNonPositive - Test if the given expression is known to be non-positive. More... | |
| bool | isKnownNonZero (const SCEV *S) |
| isKnownNonZero - Test if the given expression is known to be non-zero. More... | |
| bool | isKnownPredicate (ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS) |
| isKnownPredicate - Test if the given expression is known to satisfy the condition described by Pred, LHS, and RHS. More... | |
| bool | SimplifyICmpOperands (ICmpInst::Predicate &Pred, const SCEV *&LHS, const SCEV *&RHS, unsigned Depth=0) |
| SimplifyICmpOperands - Simplify LHS and RHS in a comparison with predicate Pred. More... | |
| LoopDisposition | getLoopDisposition (const SCEV *S, const Loop *L) |
| getLoopDisposition - Return the "disposition" of the given SCEV with respect to the given loop. More... | |
| bool | isLoopInvariant (const SCEV *S, const Loop *L) |
| isLoopInvariant - Return true if the value of the given SCEV is unchanging in the specified loop. More... | |
| bool | hasComputableLoopEvolution (const SCEV *S, const Loop *L) |
| hasComputableLoopEvolution - Return true if the given SCEV changes value in a known way in the specified loop. More... | |
| BlockDisposition | getBlockDisposition (const SCEV *S, const BasicBlock *BB) |
| getLoopDisposition - Return the "disposition" of the given SCEV with respect to the given block. More... | |
| bool | dominates (const SCEV *S, const BasicBlock *BB) |
| dominates - Return true if elements that makes up the given SCEV dominate the specified basic block. More... | |
| bool | properlyDominates (const SCEV *S, const BasicBlock *BB) |
| properlyDominates - Return true if elements that makes up the given SCEV properly dominate the specified basic block. More... | |
| bool | hasOperand (const SCEV *S, const SCEV *Op) const |
| hasOperand - Test whether the given SCEV has Op as a direct or indirect operand. More... | |
| const SCEV * | getElementSize (Instruction *Inst) |
| Return the size of an element read or written by Inst. More... | |
| void | findArrayDimensions (SmallVectorImpl< const SCEV * > &Terms, SmallVectorImpl< const SCEV * > &Sizes, const SCEV *ElementSize) const |
| Compute the array dimensions Sizes from the set of Terms extracted from the memory access function of this SCEVAddRecExpr. More... | |
| bool | runOnFunction (Function &F) override |
| runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass. More... | |
| void | releaseMemory () override |
| releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memory when it is no longer needed. More... | |
| void | getAnalysisUsage (AnalysisUsage &AU) const override |
| getAnalysisUsage - This function should be overriden by passes that need analysis information to do their job. More... | |
| void | print (raw_ostream &OS, const Module *=nullptr) const override |
| print - Print out the internal state of the pass. More... | |
| void | verifyAnalysis () const override |
| verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis information. More... | |
| void | collectParametricTerms (const SCEV *Expr, SmallVectorImpl< const SCEV * > &Terms) |
| Collect parametric terms occurring in step expressions. More... | |
| void | computeAccessFunctions (const SCEV *Expr, SmallVectorImpl< const SCEV * > &Subscripts, SmallVectorImpl< const SCEV * > &Sizes) |
| Return in Subscripts the access functions for each dimension in Sizes. More... | |
| void | delinearize (const SCEV *Expr, SmallVectorImpl< const SCEV * > &Subscripts, SmallVectorImpl< const SCEV * > &Sizes, const SCEV *ElementSize) |
| Split this SCEVAddRecExpr into two vectors of SCEVs representing the subscripts and sizes of an array access. More... | |
Public Member Functions inherited from llvm::FunctionPass | |
| FunctionPass (char &pid) | |
| Pass * | createPrinterPass (raw_ostream &O, const std::string &Banner) const override |
| createPrinterPass - Get a function printer pass. More... | |
| void | assignPassManager (PMStack &PMS, PassManagerType T) override |
| Find appropriate Function Pass Manager or Call Graph Pass Manager in the PM Stack and add self into that manager. More... | |
| PassManagerType | getPotentialPassManagerType () const override |
| Return what kind of Pass Manager can manage this pass. More... | |
Public Member Functions inherited from llvm::Pass | |
| Pass (PassKind K, char &pid) | |
| virtual | ~Pass () |
| PassKind | getPassKind () const |
| virtual const char * | getPassName () const |
| getPassName - Return a nice clean name for a pass. More... | |
| AnalysisID | getPassID () const |
| getPassID - Return the PassID number that corresponds to this pass. More... | |
| virtual bool | doInitialization (Module &) |
| doInitialization - Virtual method overridden by subclasses to do any necessary initialization before any pass is run. More... | |
| virtual bool | doFinalization (Module &) |
| doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes have run. More... | |
| void | dump () const |
| virtual void | preparePassManager (PMStack &) |
| Check if available pass managers are suitable for this pass or not. More... | |
| void | setResolver (AnalysisResolver *AR) |
| AnalysisResolver * | getResolver () const |
| virtual void * | getAdjustedAnalysisPointer (AnalysisID ID) |
| getAdjustedAnalysisPointer - This method is used when a pass implements an analysis interface through multiple inheritance. More... | |
| virtual ImmutablePass * | getAsImmutablePass () |
| virtual PMDataManager * | getAsPMDataManager () |
| virtual void | dumpPassStructure (unsigned Offset=0) |
| template<typename AnalysisType > | |
| AnalysisType * | getAnalysisIfAvailable () const |
| getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to get analysis information that might be around, for example to update it. More... | |
| bool | mustPreserveAnalysisID (char &AID) const |
| mustPreserveAnalysisID - This method serves the same function as getAnalysisIfAvailable, but works if you just have an AnalysisID. More... | |
| template<typename AnalysisType > | |
| AnalysisType & | getAnalysis () const |
| getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information that they claim to use by overriding the getAnalysisUsage function. More... | |
| template<typename AnalysisType > | |
| AnalysisType & | getAnalysis (Function &F) |
| getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information that they claim to use by overriding the getAnalysisUsage function. More... | |
| template<typename AnalysisType > | |
| AnalysisType & | getAnalysisID (AnalysisID PI) const |
| template<typename AnalysisType > | |
| AnalysisType & | getAnalysisID (AnalysisID PI, Function &F) |
Static Public Member Functions | |
| static SCEV::NoWrapFlags LLVM_ATTRIBUTE_UNUSED_RESULT | maskFlags (SCEV::NoWrapFlags Flags, int Mask) |
| Convenient NoWrapFlags manipulation that hides enum casts and is visible in the ScalarEvolution name space. More... | |
| static SCEV::NoWrapFlags LLVM_ATTRIBUTE_UNUSED_RESULT | setFlags (SCEV::NoWrapFlags Flags, SCEV::NoWrapFlags OnFlags) |
| static SCEV::NoWrapFlags LLVM_ATTRIBUTE_UNUSED_RESULT | clearFlags (SCEV::NoWrapFlags Flags, SCEV::NoWrapFlags OffFlags) |
Static Public Member Functions inherited from llvm::Pass | |
| static const PassInfo * | lookupPassInfo (const void *TI) |
| static const PassInfo * | lookupPassInfo (StringRef Arg) |
| static Pass * | createPass (AnalysisID ID) |
Static Public Attributes | |
| static char | ID = 0 |
Friends | |
| class | SCEVCallbackVH |
| class | SCEVExpander |
| class | SCEVUnknown |
Additional Inherited Members | |
Protected Member Functions inherited from llvm::FunctionPass | |
| bool | skipOptnoneFunction (const Function &F) const |
| skipOptnoneFunction - This function has Attribute::OptimizeNone and most transformation passes should skip it. More... | |
ScalarEvolution - This class is the main scalar evolution driver.
Because client code (intentionally) can't do much with the SCEV objects directly, they must ask this class for services.
Definition at line 176 of file ScalarEvolution.h.
BlockDisposition - An enum describing the relationship between a SCEV and a basic block.
| Enumerator | |
|---|---|
| DoesNotDominateBlock |
The SCEV does not dominate the block. |
| DominatesBlock |
The SCEV dominates the block. |
| ProperlyDominatesBlock |
The SCEV properly dominates the block. |
Definition at line 188 of file ScalarEvolution.h.
| ScalarEvolution::ScalarEvolution | ( | ) |
Definition at line 8062 of file ScalarEvolution.cpp.
References llvm::PassRegistry::getPassRegistry(), and llvm::initializeScalarEvolutionPass().
|
inlinestatic |
Definition at line 205 of file ScalarEvolution.h.
Referenced by getMulExpr().
| void ScalarEvolution::collectParametricTerms | ( | const SCEV * | Expr, |
| SmallVectorImpl< const SCEV * > & | Terms | ||
| ) |
Collect parametric terms occurring in step expressions.
Find parametric terms in this SCEVAddRecExpr.
Definition at line 7650 of file ScalarEvolution.cpp.
References llvm::dbgs(), DEBUG, and llvm::visitAll().
Referenced by delinearize().
| void ScalarEvolution::computeAccessFunctions | ( | const SCEV * | Expr, |
| SmallVectorImpl< const SCEV * > & | Subscripts, | ||
| SmallVectorImpl< const SCEV * > & | Sizes | ||
| ) |
Return in Subscripts the access functions for each dimension in Sizes.
Third step of delinearization: compute the access functions for the Subscripts based on the dimensions in Sizes.
Definition at line 7870 of file ScalarEvolution.cpp.
References llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorImpl< T >::clear(), llvm::dbgs(), DEBUG, llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and llvm::SmallVectorTemplateCommon< T >::size().
Referenced by delinearize().
| void ScalarEvolution::delinearize | ( | const SCEV * | Expr, |
| SmallVectorImpl< const SCEV * > & | Subscripts, | ||
| SmallVectorImpl< const SCEV * > & | Sizes, | ||
| const SCEV * | ElementSize | ||
| ) |
Split this SCEVAddRecExpr into two vectors of SCEVs representing the subscripts and sizes of an array access.
Splits the SCEV into two vectors of SCEVs representing the subscripts and sizes of an array access.
The delinearization is a 3 step process: the first two steps compute the sizes of each subscript and the third step computes the access functions for the delinearized array:
To compute a uniform array size for several memory accesses to the same object, one can collect in step 1 all the step terms for all the memory accesses, and compute in step 2 a unique array shape. This guarantees that the array shape will be the same across all memory accesses.
FIXME: We could derive the result of steps 1 and 2 from a description of the array shape given in metadata.
Example:
A[][n][m]
for i for j for k A[j+k][2i][5i] =
The initial SCEV:
A[{{{0,+,2*m+5}_i, +, n*m}_j, +, n*m}_k]
b. Divide Quotient: {{{0,+,2}_i, +, n}_j, +, n}_k by next outer size n Quotient: {{{0,+,0}_i, +, 1}_j, +, 1}_k Remainder: {{{0,+,2}_i, +, 0}_j, +, 0}_k The Remainder is the subscript of the next array dimension: [2i].
The subscript of the outermost dimension is the Quotient: [j+k].
Overall, we have: A[][n][m], and the access function: A[j+k][2i][5i].
Returns the remainder of the delinearization that is the offset start of the array. The SCEV->delinearize algorithm computes the multiples of SCEV coefficients: that is a pattern matching of sub expressions in the stride and base of a SCEV corresponding to the computation of a GCD (greatest common divisor) of base and stride. When SCEV->delinearize fails, it returns the SCEV unchanged.
For example: when analyzing the memory access A[i][j][k] in this loop nest
void foo(long n, long m, long o, double A[n][m][o]) {
for (long i = 0; i < n; i++) for (long j = 0; j < m; j++) for (long k = 0; k < o; k++) A[i][j][k] = 1.0; }
the delinearization input is the following AddRec SCEV:
AddRec: {{{A,+,(8 * m * o)}<for.i>,+,(8 * o)}<for.j>,+,8}<for.k>
From this SCEV, we are able to say that the base offset of the access is A because it appears as an offset that does not divide any of the strides in the loops:
CHECK: Base offset: A
and then SCEV->delinearize determines the size of some of the dimensions of the array as these are the multiples by which the strides are happening:
CHECK: ArrayDecl[UnknownSize][m][o] with elements of sizeof(double) bytes.
Note that the outermost dimension remains of UnknownSize because there are no strides that would help identifying the size of the last dimension: when the array has been statically allocated, one could compute the size of that dimension by dividing the overall size of the array by the size of the known dimensions: m * o * 8.
Finally delinearize provides the access functions for the array reference that does correspond to A[i][j][k] of the above C testcase:
CHECK: ArrayRef[{0,+,1}<for.i>][{0,+,1}<for.j>][{0,+,1}<for.k>]
The testcases are checking the output of a function pass: DelinearizationPass that walks through all loads and stores of a function asking for the SCEV of the memory access with respect to all enclosing loops, calling SCEV->delinearize on that and printing the results.
Definition at line 7978 of file ScalarEvolution.cpp.
References collectParametricTerms(), computeAccessFunctions(), llvm::dbgs(), DEBUG, llvm::SmallVectorBase::empty(), and findArrayDimensions().
| bool ScalarEvolution::dominates | ( | const SCEV * | S, |
| const BasicBlock * | BB | ||
| ) |
dominates - Return true if elements that makes up the given SCEV dominate the specified basic block.
Definition at line 8402 of file ScalarEvolution.cpp.
References DominatesBlock, and getBlockDisposition().
| void ScalarEvolution::findArrayDimensions | ( | SmallVectorImpl< const SCEV * > & | Terms, |
| SmallVectorImpl< const SCEV * > & | Sizes, | ||
| const SCEV * | ElementSize | ||
| ) | const |
Compute the array dimensions Sizes from the set of Terms extracted from the memory access function of this SCEVAddRecExpr.
Second step of delinearization: compute the array dimensions Sizes from the set of Terms extracted from the memory access function of this SCEVAddRec.
Definition at line 7803 of file ScalarEvolution.cpp.
References llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorImpl< T >::clear(), containsParameters(), llvm::dbgs(), DEBUG, llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::SmallVectorImpl< T >::erase(), findArrayDimensionsRec(), numberOfTerms(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), removeConstantFactors(), and llvm::SmallVectorTemplateCommon< T >::size().
Referenced by delinearize().
forgetLoop - This method should be called by the client when it has changed a loop in a way that may effect ScalarEvolution's ability to compute a trip count, or if the loop is deleted.
This call is potentially expensive for large loop bodies.
Definition at line 4679 of file ScalarEvolution.cpp.
References llvm::LoopBase< N, M >::begin(), llvm::SmallVectorBase::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::LoopBase< N, M >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::erase(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find_as(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::SmallVectorImpl< T >::pop_back_val(), PushDefUseChildren(), and PushLoopPHIs().
Referenced by llvm::formLCSSA(), separateNestedLoop(), simplifyOneLoop(), llvm::UnrollLoop(), and llvm::UnrollRuntimeLoopProlog().
Called when the client has changed the disposition of values in this loop.
We don't have a way to invalidate per-loop dispositions. Clear and recompute is simpler.
Definition at line 852 of file ScalarEvolution.h.
Referenced by simplifyOneLoop().
| void ScalarEvolution::forgetValue | ( | Value * | V | ) |
forgetValue - This method should be called by the client when it has changed a value in a way that may effect its value, or which may disconnect it from a def-use chain linking it to a loop.
Definition at line 4719 of file ScalarEvolution.cpp.
References llvm::dyn_cast(), llvm::SmallVectorBase::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::erase(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find_as(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and PushDefUseChildren().
Referenced by simplifyOneLoop().
| const SCEV * ScalarEvolution::getAddExpr | ( | SmallVectorImpl< const SCEV * > & | Ops, |
| SCEV::NoWrapFlags | Flags = SCEV::FlagAnyWrap |
||
| ) |
getAddExpr - Get a canonical add expression, or something simpler if possible.
Definition at line 1970 of file ScalarEvolution.cpp.
References llvm::FoldingSetNodeID::AddInteger(), llvm::AddOne(), llvm::FoldingSetNodeID::AddPointer(), llvm::BumpPtrAllocatorImpl< AllocatorT, SlabSize, SizeThreshold >::Allocate(), llvm::SmallVectorImpl< T >::append(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::C, llvm::SmallVectorImpl< T >::clear(), CollectAddOperandsWithScales(), llvm::SmallVectorTemplateCommon< T >::data(), llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::SmallVectorImpl< T >::erase(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::SCEV::FlagAnyWrap, llvm::SCEV::FlagNSW, llvm::SCEV::FlagNUW, llvm::SCEV::FlagNW, getAddRecExpr(), getAnyExtendExpr(), getConstant(), getEffectiveSCEVType(), llvm::SCEVAddRecExpr::getLoop(), getMulExpr(), llvm::SCEVNAryExpr::getNoWrapFlags(), llvm::SCEVNAryExpr::getNumOperands(), llvm::SCEVCastExpr::getOperand(), llvm::SCEVNAryExpr::getOperand(), llvm::SCEVAddRecExpr::getStart(), getTruncateExpr(), llvm::Intrinsic::getType(), llvm::SCEVCastExpr::getType(), llvm::SCEV::getType(), getTypeSizeInBits(), GroupByComplexity(), I, ID, llvm::FoldingSetNodeID::Intern(), isLoopInvariant(), One, llvm::SCEVNAryExpr::op_begin(), llvm::SCEVNAryExpr::op_end(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::scAddExpr, llvm::scAddRecExpr, llvm::scMulExpr, setFlags(), llvm::SCEVCommutativeExpr::setNoWrapFlags(), llvm::SmallVectorTemplateCommon< T >::size(), and StrengthenNoWrapFlags().
Referenced by canBeCheaplyTransformed(), llvm::SCEVAddRecExpr::evaluateAtIteration(), ExposePointerBase(), ExtractImmediate(), ExtractSymbol(), FactorOutConstant(), genLoopLimit(), getAddExpr(), getExactSDiv(), getExtendAddRecStart(), getGEPExpr(), getMinusSCEV(), getMulExpr(), llvm::SCEVAddRecExpr::getPostIncExpr(), getPreStartForExtend(), getSignExtendExpr(), getSmallConstantTripMultiple(), getTruncateExpr(), getUDivExpr(), getZeroExtendExpr(), IsIncrementNSW(), IsIncrementNUW(), SimplifyAddOperands(), SimplifyICmpOperands(), llvm::UnrollRuntimeLoopProlog(), llvm::SCEVParameterRewriter::visitAddExpr(), and llvm::SCEVApplyRewriter::visitAddExpr().
|
inline |
Definition at line 616 of file ScalarEvolution.h.
References getAddExpr(), and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
|
inline |
Definition at line 623 of file ScalarEvolution.h.
References getAddExpr(), and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
| const SCEV * ScalarEvolution::getAddRecExpr | ( | const SCEV * | Start, |
| const SCEV * | Step, | ||
| const Loop * | L, | ||
| SCEV::NoWrapFlags | Flags | ||
| ) |
getAddRecExpr - Get an add recurrence expression for the specified loop.
Simplify the expression as much as possible.
Definition at line 2815 of file ScalarEvolution.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::SCEV::FlagNW, maskFlags(), Operands, and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
Referenced by DoInitialMatch(), ExposePointerBase(), ExtractImmediate(), ExtractSymbol(), FactorOutConstant(), getAddExpr(), getAddRecExpr(), getAnyExtendExpr(), getMulExpr(), llvm::SCEVAddRecExpr::getNumIterationsInRange(), getPreStartForExtend(), getSignExtendExpr(), llvm::SCEVAddRecExpr::getStepRecurrence(), getTruncateExpr(), getUDivExpr(), getZeroExtendExpr(), SplitAddRecs(), llvm::SCEVParameterRewriter::visitAddRecExpr(), and llvm::SCEVApplyRewriter::visitAddRecExpr().
| const SCEV * ScalarEvolution::getAddRecExpr | ( | SmallVectorImpl< const SCEV * > & | Operands, |
| const Loop * | L, | ||
| SCEV::NoWrapFlags | Flags | ||
| ) |
getAddRecExpr - Get an add recurrence expression for the specified loop.
Simplify the expression as much as possible.
Definition at line 2833 of file ScalarEvolution.cpp.
References llvm::FoldingSetNodeID::AddInteger(), llvm::FoldingSetNodeID::AddPointer(), llvm::BumpPtrAllocatorImpl< AllocatorT, SlabSize, SizeThreshold >::Allocate(), llvm::SmallVectorTemplateCommon< T >::back(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::LoopBase< N, M >::contains(), llvm::DominatorTree::dominates(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::SCEV::FlagAnyWrap, llvm::SCEV::FlagNW, getAddRecExpr(), getEffectiveSCEVType(), llvm::LoopBase< N, M >::getHeader(), llvm::LoopBase< N, M >::getLoopDepth(), llvm::Intrinsic::getType(), ID, llvm::FoldingSetNodeID::Intern(), isLoopInvariant(), llvm::SCEV::isZero(), maskFlags(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::pop_back(), llvm::scAddRecExpr, llvm::SCEVAddRecExpr::setNoWrapFlags(), llvm::SmallVectorTemplateCommon< T >::size(), and StrengthenNoWrapFlags().
|
inline |
Definition at line 655 of file ScalarEvolution.h.
References llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorTemplateCommon< T >::end(), and getAddRecExpr().
|
overridevirtual |
getAnalysisUsage - This function should be overriden by passes that need analysis information to do their job.
If a pass specifies that it uses a particular analysis result to this function, it can then use the getAnalysis<AnalysisType>() function, below.
Reimplemented from llvm::Pass.
Definition at line 8108 of file ScalarEvolution.cpp.
References llvm::AnalysisUsage::addRequired(), llvm::AnalysisUsage::addRequiredTransitive(), and llvm::AnalysisUsage::setPreservesAll().
getAnyExtendExpr - Return a SCEV for the given operand extended with unspecified bits out to the given type.
Definition at line 1791 of file ScalarEvolution.cpp.
References llvm::SCEV::FlagNW, getAddRecExpr(), getEffectiveSCEVType(), getSignExtendExpr(), getTruncateOrNoop(), llvm::SCEV::getType(), getTypeSizeInBits(), getZeroExtendExpr(), isSCEVable(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and llvm::PPCISD::SC.
Referenced by getAddExpr(), and getNoopOrAnyExtend().
getBackedgeTakenCount - If the specified loop has a predictable backedge-taken count, return it, otherwise return a SCEVCouldNotCompute object.
The backedge-taken count is the number of times the loop header will be branched to from within the loop. This is one less than the trip count of the loop, since it doesn't count the first iteration, when the header is branched to from outside the loop.
Note that it is not valid to call this method on a loop without a loop-invariant backedge-taken count (see hasLoopInvariantBackedgeTakenCount).
Definition at line 4578 of file ScalarEvolution.cpp.
Referenced by canExpandBackedgeTakenCount(), getLoopBackedgeTakenCounts(), getPreStartForExtend(), hasLoopInvariantBackedgeTakenCount(), llvm::RuntimePointerChecking::insert(), llvm::IVUsers::print(), PrintLoopInfo(), and llvm::UnrollRuntimeLoopProlog().
| ScalarEvolution::BlockDisposition ScalarEvolution::getBlockDisposition | ( | const SCEV * | S, |
| const BasicBlock * | BB | ||
| ) |
getLoopDisposition - Return the "disposition" of the given SCEV with respect to the given block.
Definition at line 8321 of file ScalarEvolution.cpp.
References DoesNotDominateBlock, and llvm::make_range().
Referenced by dominates(), and properlyDominates().
| const SCEV * ScalarEvolution::getConstant | ( | ConstantInt * | V | ) |
Definition at line 316 of file ScalarEvolution.cpp.
References llvm::FoldingSetNodeID::AddInteger(), llvm::FoldingSetNodeID::AddPointer(), ID, llvm::FoldingSetNodeID::Intern(), llvm::IP, and llvm::scConstant.
Referenced by BinomialCoefficient(), DoInitialMatch(), EvaluateConstantChrecAtConstant(), ExposePointerBase(), ExtractImmediate(), ExtractSymbol(), FactorOutConstant(), getAddExpr(), getConstant(), getExactSDiv(), getGEPExpr(), getMinusSCEV(), getMulExpr(), getNegativeSCEV(), getNotSCEV(), llvm::SCEVAddRecExpr::getNumIterationsInRange(), getOffsetOfExpr(), getSignedOverflowLimitForStep(), getSignExtendExpr(), getSizeOfExpr(), getSmallConstantTripMultiple(), getSMaxExpr(), getTruncateExpr(), getUDivExactExpr(), getUDivExpr(), getUMaxExpr(), getUnsignedOverflowLimitForStep(), getZeroExtendExpr(), SimplifyAddOperands(), SimplifyICmpOperands(), SolveLinEquationWithOverflow(), SolveQuadraticEquation(), SplitAddRecs(), llvm::UnrollRuntimeLoopProlog(), and llvm::SCEVParameterRewriter::visitUnknown().
Definition at line 327 of file ScalarEvolution.cpp.
References llvm::ConstantInt::get(), getConstant(), and getContext().
Definition at line 332 of file ScalarEvolution.cpp.
References llvm::ConstantInt::get(), getConstant(), and getEffectiveSCEVType().
|
inline |
Definition at line 585 of file ScalarEvolution.h.
References llvm::Function::getContext().
Referenced by BinomialCoefficient(), FactorOutConstant(), getConstant(), getMulExpr(), llvm::SCEVAddRecExpr::getNumIterationsInRange(), getPreStartForExtend(), getSignExtendExpr(), getSMaxExpr(), getUDivExpr(), getUMaxExpr(), getZeroExtendExpr(), isAddRecSExtable(), isAddSExtable(), isMulSExtable(), SimplifyICmpOperands(), and SolveQuadraticEquation().
Definition at line 3277 of file ScalarEvolution.cpp.
Referenced by BinomialCoefficient(), llvm::SCEVAddRecExpr::getNumIterationsInRange(), getSmallConstantTripMultiple(), mustBeFiniteCountedLoop(), SolveLinEquationWithOverflow(), and SolveQuadraticEquation().
getEffectiveSCEVType - Return a type with the same bitwidth as the given type and which represents how SCEV will treat the given type, for which isSCEVable must return true.
For pointer types, this is the pointer-sized integer type.
Definition at line 3265 of file ScalarEvolution.cpp.
References llvm::Module::getDataLayout(), llvm::DataLayout::getIntPtrType(), llvm::GlobalValue::getParent(), llvm::Type::isIntegerTy(), llvm::Type::isPointerTy(), and isSCEVable().
Referenced by canBeCheaplyTransformed(), DoInitialMatch(), genLoopLimit(), getAddExpr(), getAddRecExpr(), getAnyExtendExpr(), getConstant(), getElementSize(), getGEPExpr(), getMulExpr(), getNegativeSCEV(), getNotSCEV(), getSignExtendExpr(), getSMaxExpr(), getTruncateExpr(), getUDivExpr(), getUMaxExpr(), getZeroExtendExpr(), isExistingPhi(), and visitIVCast().
| const SCEV * ScalarEvolution::getElementSize | ( | Instruction * | Inst | ) |
Return the size of an element read or written by Inst.
Definition at line 7788 of file ScalarEvolution.cpp.
References getEffectiveSCEVType(), getSizeOfExpr(), llvm::PointerType::getUnqual(), llvm::SPII::Load, and llvm::SPII::Store.
Referenced by llvm::DependenceAnalysis::depends(), and llvm::DependenceAnalysis::getSplitIteration().
| const SCEV * ScalarEvolution::getExitCount | ( | Loop * | L, |
| BasicBlock * | ExitingBlock | ||
| ) |
Definition at line 4563 of file ScalarEvolution.cpp.
Referenced by getSmallConstantTripCount(), getSmallConstantTripMultiple(), and mustBeFiniteCountedLoop().
| const SCEV * ScalarEvolution::getGEPExpr | ( | Type * | PointeeType, |
| const SCEV * | BaseExpr, | ||
| const SmallVectorImpl< const SCEV * > & | IndexExprs, | ||
| bool | InBounds = false |
||
| ) |
Returns an expression for a GEP.
PointeeType The type used as the basis for the pointer arithmetics BaseExpr The expression for the pointer operand. IndexExprs The expressions for the indices. InBounds Whether the GEP is in bounds.
Definition at line 2930 of file ScalarEvolution.cpp.
References llvm::SCEV::FlagAnyWrap, llvm::SCEV::FlagNSW, getAddExpr(), getConstant(), getEffectiveSCEVType(), getMulExpr(), getOffsetOfExpr(), getSizeOfExpr(), getTruncateOrSignExtend(), llvm::SCEV::getType(), llvm::PointerType::getUnqual(), and llvm::ConstantInt::getZExtValue().
| ScalarEvolution::LoopDisposition ScalarEvolution::getLoopDisposition | ( | const SCEV * | S, |
| const Loop * | L | ||
| ) |
getLoopDisposition - Return the "disposition" of the given SCEV with respect to the given loop.
Definition at line 8215 of file ScalarEvolution.cpp.
References LoopVariant, and llvm::make_range().
Referenced by hasComputableLoopEvolution(), and isLoopInvariant().
getMaxBackedgeTakenCount - Similar to getBackedgeTakenCount, except return the least SCEV value that is known never to be less than the actual backedge taken count.
Definition at line 4585 of file ScalarEvolution.cpp.
Referenced by getSignExtendExpr(), getZeroExtendExpr(), mustBeFiniteCountedLoop(), and PrintLoopInfo().
GetMinTrailingZeros - Determine the minimum number of zero bits that S is guaranteed to end in (at every loop iteration).
It is, at the same time, the minimum number of times S is divisible by 2. For example, given {4,+,8} it returns 2. If S is guaranteed to be 0, it returns the bitwidth of S.
Definition at line 3770 of file ScalarEvolution.cpp.
References llvm::ARM_PROC::A, llvm::C, llvm::computeKnownBits(), getTypeSizeInBits(), and fuzzer::min().
| const SCEV * ScalarEvolution::getMinusSCEV | ( | const SCEV * | LHS, |
| const SCEV * | RHS, | ||
| SCEV::NoWrapFlags | Flags = SCEV::FlagAnyWrap |
||
| ) |
getMinusSCEV - Return LHS-RHS. Minus is represented in SCEV as A+B*-1.
Definition at line 3363 of file ScalarEvolution.cpp.
References llvm::SCEV::FlagNUW, getAddExpr(), getConstant(), getNegativeSCEV(), llvm::SCEV::getType(), and maskFlags().
Referenced by BinomialCoefficient(), getMinFromExprs(), getNewAlignment(), getNewAlignmentDiff(), and getNotSCEV().
| const SCEV * ScalarEvolution::getMulExpr | ( | SmallVectorImpl< const SCEV * > & | Ops, |
| SCEV::NoWrapFlags | Flags = SCEV::FlagAnyWrap |
||
| ) |
getMulExpr - Get a canonical multiply expression, or something simpler if possible.
Definition at line 2378 of file ScalarEvolution.cpp.
References llvm::FoldingSetNodeID::AddInteger(), llvm::FoldingSetNodeID::AddPointer(), llvm::BumpPtrAllocatorImpl< AllocatorT, SlabSize, SizeThreshold >::Allocate(), llvm::SmallVectorImpl< T >::append(), llvm::SmallVectorTemplateCommon< T >::begin(), Choose(), clearFlags(), containsConstantSomewhere(), llvm::dyn_cast(), llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::SmallVectorImpl< T >::erase(), llvm::SCEV::FlagAnyWrap, llvm::SCEV::FlagNSW, llvm::SCEV::FlagNUW, llvm::SCEV::FlagNW, llvm::ConstantInt::get(), getAddExpr(), getAddRecExpr(), getConstant(), getContext(), getEffectiveSCEVType(), llvm::SCEVAddRecExpr::getLoop(), llvm::SCEVNAryExpr::getNoWrapFlags(), llvm::SCEVNAryExpr::getNumOperands(), llvm::SCEVNAryExpr::getOperand(), llvm::Intrinsic::getType(), llvm::SCEVNAryExpr::getType(), getTypeSizeInBits(), GroupByComplexity(), I, ID, llvm::FoldingSetNodeID::Intern(), isLoopInvariant(), maskFlags(), fuzzer::min(), Operands, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorImpl< T >::reserve(), llvm::scAddRecExpr, llvm::scMulExpr, llvm::SCEVCommutativeExpr::setNoWrapFlags(), llvm::SmallVectorTemplateCommon< T >::size(), StrengthenNoWrapFlags(), and umul_ov().
Referenced by BinomialCoefficient(), CollectAddOperandsWithScales(), CollectSubexprs(), DoInitialMatch(), llvm::SCEVAddRecExpr::evaluateAtIteration(), FactorOutConstant(), findArrayDimensionsRec(), getAddExpr(), getExactSDiv(), getGEPExpr(), getMulExpr(), getNegativeSCEV(), getNewAlignmentDiff(), getSignExtendExpr(), getTruncateExpr(), getUDivExactExpr(), getUDivExpr(), getZeroExtendExpr(), removeConstantFactors(), llvm::SCEVParameterRewriter::visitMulExpr(), and llvm::SCEVApplyRewriter::visitMulExpr().
|
inline |
Definition at line 633 of file ScalarEvolution.h.
References getMulExpr(), and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
|
inline |
Definition at line 641 of file ScalarEvolution.h.
References getMulExpr(), and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
getNegativeSCEV - Return the SCEV object corresponding to -V.
getNegativeSCEV - Return a SCEV corresponding to -V = -1*V
Definition at line 3338 of file ScalarEvolution.cpp.
References llvm::Constant::getAllOnesValue(), getConstant(), getEffectiveSCEVType(), getMulExpr(), llvm::ConstantExpr::getNeg(), llvm::SCEV::getType(), and llvm::AArch64CC::VC.
Referenced by canBeCheaplyTransformed(), getMinusSCEV(), and llvm::SCEVAddRecExpr::getNumIterationsInRange().
getNoopOrAnyExtend - Return a SCEV corresponding to a conversion of the input value to the specified type.
If the type must be extended, it is extended with unspecified bits. The conversion must not be narrowing.
Definition at line 3446 of file ScalarEvolution.cpp.
References getAnyExtendExpr(), llvm::SCEV::getType(), getTypeSizeInBits(), llvm::Type::isIntegerTy(), and llvm::Type::isPointerTy().
getNoopOrSignExtend - Return a SCEV corresponding to a conversion of the input value to the specified type.
If the type must be extended, it is sign extended. The conversion must not be narrowing.
Definition at line 3429 of file ScalarEvolution.cpp.
References getSignExtendExpr(), llvm::SCEV::getType(), getTypeSizeInBits(), llvm::Type::isIntegerTy(), and llvm::Type::isPointerTy().
Referenced by getNewAlignment().
getNoopOrZeroExtend - Return a SCEV corresponding to a conversion of the input value to the specified type.
If the type must be extended, it is zero extended. The conversion must not be narrowing.
Definition at line 3413 of file ScalarEvolution.cpp.
References llvm::SCEV::getType(), getTypeSizeInBits(), getZeroExtendExpr(), llvm::Type::isIntegerTy(), and llvm::Type::isPointerTy().
Referenced by getUMaxFromMismatchedTypes(), and getUMinFromMismatchedTypes().
getNotSCEV - Return the SCEV object corresponding to ~V.
getNotSCEV - Return a SCEV corresponding to ~V = -1-V
Definition at line 3350 of file ScalarEvolution.cpp.
References llvm::Constant::getAllOnesValue(), getConstant(), getEffectiveSCEVType(), getMinusSCEV(), llvm::ConstantExpr::getNot(), llvm::SCEV::getType(), and llvm::AArch64CC::VC.
Referenced by getSMinExpr(), getUMinExpr(), and IsMinConsistingOf().
| const SCEV * ScalarEvolution::getOffsetOfExpr | ( | Type * | IntTy, |
| StructType * | STy, | ||
| unsigned | FieldNo | ||
| ) |
getOffsetOfExpr - Return an expression for offsetof on the given field with type IntTy
Definition at line 3207 of file ScalarEvolution.cpp.
References getConstant(), llvm::Module::getDataLayout(), llvm::StructLayout::getElementOffset(), llvm::GlobalValue::getParent(), and llvm::DataLayout::getStructLayout().
Referenced by getGEPExpr().
getPointerBase - Transitively follow the chain of pointer-type operands until reaching a SCEV that does not have a single pointer operand.
This returns a SCEVUnknown pointer for well-formed pointer-type expressions, but corner cases do exist.
Definition at line 3509 of file ScalarEvolution.cpp.
References llvm::SCEV::getType(), I, and llvm::Type::isPointerTy().
getSCEV - Return a SCEV expression for the full generality of the specified expression.
getSCEV - Return an existing SCEV if it exists, otherwise analyze the expression and create a new one.
Definition at line 3315 of file ScalarEvolution.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::erase(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find_as(), llvm::Value::getType(), I, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), isSCEVable(), and SCEVCallbackVH.
Referenced by llvm::LoopAccessInfo::addRuntimeCheck(), llvm::IVUsers::AddUsersImpl(), llvm::DependenceAnalysis::depends(), DoInitialMatch(), findIVOperand(), FindLoopCounter(), genLoopLimit(), getNewAlignment(), llvm::IVUsers::getReplacementExpr(), getSCEVAtScope(), llvm::DependenceAnalysis::getSplitIteration(), llvm::getStrideFromPointer(), isExistingPhi(), isHighCostExpansion(), llvm::isInductionPHI(), isLikelyComplexAddressComputation(), isNoWrapAddRec(), isProfitableChain(), isSimpleIVUser(), llvm::LoopAccessInfo::isUniform(), print(), llvm::replaceSymbolicStrideSCEV(), and llvm::stripGetElementPtr().
getSCEVAtScope - Return a SCEV expression for the specified value at the specified scope in the program.
The L value specifies a loop nest to evaluate the expression at, where null is the top-level or a specified loop is immediately inside of the loop.
This method can be used to compute the exit value for a variable defined in a loop by querying what the value will hold in the parent loop.
In the case that a relevant loop exit value cannot be computed, the original value V is returned.
Definition at line 5640 of file ScalarEvolution.cpp.
References llvm::C, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and llvm::SmallVectorTemplateCommon< T >::size().
Referenced by getSCEVAtScope(), isInteresting(), and print().
getSCEVAtScope - This is a convenience function which does getSCEVAtScope(getSCEV(V), L).
Definition at line 5955 of file ScalarEvolution.cpp.
References getSCEV(), and getSCEVAtScope().
|
inline |
getSignedRange - Determine the signed range for a particular SCEV.
Definition at line 869 of file ScalarEvolution.h.
Referenced by CanBeSMax(), CanBeSMin(), getSignedOverflowLimitForStep(), getSignExtendExpr(), getZeroExtendExpr(), isKnownNegative(), isKnownNonNegative(), isKnownNonPositive(), isKnownPositive(), print(), and SimplifyICmpOperands().
Definition at line 1590 of file ScalarEvolution.cpp.
References llvm::FoldingSetNodeID::AddInteger(), llvm::FoldingSetNodeID::AddPointer(), llvm::ConstantRange::contains(), llvm::dyn_cast(), llvm::SCEV::FlagNSW, llvm::SCEV::FlagNW, llvm::IntegerType::get(), getAddExpr(), getAddRecExpr(), getConstant(), getContext(), getEffectiveSCEVType(), getMaxBackedgeTakenCount(), getMulExpr(), llvm::ConstantExpr::getSExt(), getSignedOverflowLimitForStep(), getSignedRange(), getTruncateOrSignExtend(), getTruncateOrZeroExtend(), llvm::SCEV::getType(), getTypeSizeInBits(), getZeroExtendExpr(), ID, llvm::FoldingSetNodeID::Intern(), isKnownNonNegative(), isLoopBackedgeGuardedByCond(), isLoopEntryGuardedByCond(), llvm::APInt::isPowerOf2(), isSCEVable(), llvm::APInt::isStrictlyPositive(), llvm::PPCISD::SC, llvm::scSignExtend, llvm::ConstantRange::sextOrTrunc(), llvm::ConstantRange::signExtend(), llvm::SS, llvm::AArch64DB::ST, llvm::ConstantRange::truncate(), and llvm::APInt::ugt().
Referenced by getAnyExtendExpr(), getNoopOrSignExtend(), getTruncateOrSignExtend(), getZeroExtendExpr(), isAddRecSExtable(), isAddSExtable(), IsIncrementNSW(), isMulSExtable(), llvm::SCEVParameterRewriter::visitSignExtendExpr(), and llvm::SCEVApplyRewriter::visitSignExtendExpr().
getSizeOfExpr - Return an expression for sizeof AllocTy that is type IntTy
Definition at line 3199 of file ScalarEvolution.cpp.
References getConstant(), llvm::Module::getDataLayout(), llvm::GlobalValue::getParent(), and llvm::DataLayout::getTypeAllocSize().
Referenced by genLoopLimit(), getElementSize(), and getGEPExpr().
Returns the maximum trip count of the loop if it is a single-exit loop and we can compute a small maximum for that loop.
Implemented in terms of the getSmallConstantTripCount overload with the single exiting block passed to it. See that routine for details.
Definition at line 4468 of file ScalarEvolution.cpp.
References llvm::LoopBase< N, M >::getExitingBlock().
| unsigned ScalarEvolution::getSmallConstantTripCount | ( | Loop * | L, |
| BasicBlock * | ExitingBlock | ||
| ) |
getSmallConstantTripCount - Returns the maximum trip count of this loop as a normal unsigned value.
Returns 0 if the trip count is unknown or not constant. This "trip count" assumes that control exits via ExitingBlock. More precisely, it is the number of times that control may reach ExitingBlock before taking the branch. For loops with multiple exits, it may not be the number times that the loop header executes if the loop exits prematurely via another branch.
Returns 0 if the trip count is unknown or not constant. Will also return 0 if the maximum trip count is very large (>= 2^32).
This "trip count" assumes that control exits via ExitingBlock. More precisely, it is the number of times that control may reach ExitingBlock before taking the branch. For loops with multiple exits, it may not be the number times that the loop header executes because the loop may exit prematurely via another branch.
Definition at line 4486 of file ScalarEvolution.cpp.
References llvm::dyn_cast(), llvm::APInt::getActiveBits(), getExitCount(), llvm::ConstantInt::getValue(), llvm::ConstantInt::getZExtValue(), and llvm::LoopBase< N, M >::isLoopExiting().
Returns the largest constant divisor of the trip count of the loop if it is a single-exit loop and we can compute a small maximum for that loop.
Implemented in terms of the getSmallConstantTripMultiple overload with the single exiting block passed to it. See that routine for details.
Definition at line 4506 of file ScalarEvolution.cpp.
References llvm::LoopBase< N, M >::getExitingBlock().
| unsigned ScalarEvolution::getSmallConstantTripMultiple | ( | Loop * | L, |
| BasicBlock * | ExitingBlock | ||
| ) |
getSmallConstantTripMultiple - Returns the largest constant divisor of the trip count of this loop as a normal unsigned value, if possible.
This means that the actual trip count is always a multiple of the returned value (don't forget the trip count could very well be zero as well!). As explained in the comments for getSmallConstantTripCount, this assumes that control exits the loop via ExitingBlock.
This means that the actual trip count is always a multiple of the returned value (don't forget the trip count could very well be zero as well!).
Returns 1 if the trip count is unknown or not guaranteed to be the multiple of a constant (which is also the case if the trip count is simply constant, use getSmallConstantTripCount for that case), Will also return 1 if the trip count is very large (>= 2^32).
As explained in the comments for getSmallConstantTripCount, this assumes that control exits the loop via ExitingBlock.
Definition at line 4527 of file ScalarEvolution.cpp.
References llvm::dyn_cast(), llvm::APInt::getActiveBits(), getAddExpr(), getConstant(), getCouldNotCompute(), getExitCount(), llvm::SCEVConstant::getValue(), llvm::ConstantInt::getValue(), llvm::ConstantInt::getZExtValue(), and llvm::LoopBase< N, M >::isLoopExiting().
Definition at line 2979 of file ScalarEvolution.cpp.
References llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
Referenced by getSMaxExpr(), getSMinExpr(), IntersectRange(), llvm::SCEVParameterRewriter::visitSMaxExpr(), and llvm::SCEVApplyRewriter::visitSMaxExpr().
| const SCEV * ScalarEvolution::getSMaxExpr | ( | SmallVectorImpl< const SCEV * > & | Operands | ) |
Definition at line 2988 of file ScalarEvolution.cpp.
References llvm::BumpPtrAllocatorImpl< AllocatorT, SlabSize, SizeThreshold >::Allocate(), llvm::SmallVectorImpl< T >::append(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::SmallVectorImpl< T >::erase(), llvm::ConstantInt::get(), getConstant(), getContext(), getEffectiveSCEVType(), getSMaxExpr(), llvm::Intrinsic::getType(), GroupByComplexity(), llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SLE, ID, isKnownPredicate(), llvm::scSMaxExpr, llvm::SmallVectorTemplateCommon< T >::size(), and llvm::APIntOps::smax().
Definition at line 3187 of file ScalarEvolution.cpp.
References getNotSCEV(), and getSMaxExpr().
Referenced by IntersectRange().
Definition at line 1087 of file ScalarEvolution.cpp.
References llvm::FoldingSetNodeID::AddInteger(), llvm::FoldingSetNodeID::AddPointer(), llvm::SCEV::FlagAnyWrap, getAddExpr(), getAddRecExpr(), getConstant(), getEffectiveSCEVType(), getMulExpr(), llvm::ConstantExpr::getTrunc(), getTruncateOrSignExtend(), getTruncateOrZeroExtend(), llvm::SCEV::getType(), getTypeSizeInBits(), ID, llvm::FoldingSetNodeID::Intern(), llvm::IP, isSCEVable(), Operands, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::PPCISD::SC, llvm::scTruncate, llvm::SS, and llvm::AArch64DB::ST.
Referenced by genLoopLimit(), getAddExpr(), getTruncateOrNoop(), getTruncateOrSignExtend(), getTruncateOrZeroExtend(), llvm::SCEVParameterRewriter::visitTruncateExpr(), and llvm::SCEVApplyRewriter::visitTruncateExpr().
getTruncateOrNoop - Return a SCEV corresponding to a conversion of the input value to the specified type.
The conversion must not be widening.
Definition at line 3461 of file ScalarEvolution.cpp.
References getTruncateExpr(), llvm::SCEV::getType(), getTypeSizeInBits(), llvm::Type::isIntegerTy(), and llvm::Type::isPointerTy().
Referenced by canBeCheaplyTransformed(), and getAnyExtendExpr().
getTruncateOrSignExtend - Return a SCEV corresponding to a conversion of the input value to the specified type.
If the type must be extended, it is sign extended.
Definition at line 3396 of file ScalarEvolution.cpp.
References getSignExtendExpr(), getTruncateExpr(), llvm::SCEV::getType(), getTypeSizeInBits(), llvm::Type::isIntegerTy(), and llvm::Type::isPointerTy().
Referenced by getGEPExpr(), getSignExtendExpr(), and getTruncateExpr().
getTruncateOrZeroExtend - Return a SCEV corresponding to a conversion of the input value to the specified type.
If the type must be extended, it is zero extended.
Definition at line 3380 of file ScalarEvolution.cpp.
References getTruncateExpr(), llvm::SCEV::getType(), getTypeSizeInBits(), getZeroExtendExpr(), llvm::Type::isIntegerTy(), and llvm::Type::isPointerTy().
Referenced by BinomialCoefficient(), genLoopLimit(), getSignExtendExpr(), getTruncateExpr(), and getZeroExtendExpr().
| uint64_t ScalarEvolution::getTypeSizeInBits | ( | Type * | Ty | ) | const |
getTypeSizeInBits - Return the size in bits of the specified type, for which isSCEVable must return true.
Definition at line 3256 of file ScalarEvolution.cpp.
References llvm::Module::getDataLayout(), llvm::GlobalValue::getParent(), llvm::DataLayout::getTypeSizeInBits(), and isSCEVable().
Referenced by llvm::IVUsers::AddUsersImpl(), BinomialCoefficient(), FindLoopCounter(), genLoopLimit(), getAddExpr(), getAnyExtendExpr(), GetMinTrailingZeros(), getMulExpr(), getNoopOrAnyExtend(), getNoopOrSignExtend(), getNoopOrZeroExtend(), llvm::SCEVAddRecExpr::getNumIterationsInRange(), getPreStartForExtend(), getSignedOverflowLimitForStep(), getSignExtendExpr(), getTruncateExpr(), getTruncateOrNoop(), getTruncateOrSignExtend(), getTruncateOrZeroExtend(), getUDivExpr(), getUMaxFromMismatchedTypes(), getUMinFromMismatchedTypes(), getUnsignedOverflowLimitForStep(), getZeroExtendExpr(), isAddRecSExtable(), isAddSExtable(), isMulSExtable(), and visitIVCast().
getUDivExactExpr - Get a canonical unsigned division expression, or something simpler if possible.
There is no representation for an exact udiv in SCEV IR, but we can attempt to remove factors from the LHS and RHS. We can't do this when it's not exact because the udiv may be clearing bits.
Definition at line 2759 of file ScalarEvolution.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::dyn_cast(), gcd(), getConstant(), getMulExpr(), llvm::SCEVNAryExpr::getNumOperands(), llvm::SCEVNAryExpr::getOperand(), getUDivExpr(), llvm::APInt::isIntN(), llvm::SCEVNAryExpr::op_begin(), llvm::SCEVNAryExpr::op_end(), Operands, and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
getUDivExpr - Get a canonical unsigned division expression, or something simpler if possible.
Get a canonical UDivExpr for a recurrence. {X,+,N}/C => {Y,+,N}/C where Y=X-(XN). Safe when CN=0.
Definition at line 2624 of file ScalarEvolution.cpp.
References llvm::ARM_PROC::A, llvm::FoldingSetNodeID::AddInteger(), llvm::FoldingSetNodeID::AddPointer(), llvm::SmallVectorImpl< T >::clear(), llvm::dyn_cast(), llvm::SCEV::FlagAnyWrap, llvm::SCEV::FlagNW, llvm::IntegerType::get(), getAddExpr(), getAddRecExpr(), getConstant(), getContext(), getEffectiveSCEVType(), getMulExpr(), llvm::SCEV::getType(), getTypeSizeInBits(), llvm::ConstantExpr::getUDiv(), llvm::SCEVConstant::getValue(), llvm::ConstantInt::getValue(), getZeroExtendExpr(), ID, llvm::FoldingSetNodeID::Intern(), Operands, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::scUDivExpr, llvm::SmallVectorTemplateCommon< T >::size(), and llvm::APInt::urem().
Referenced by BinomialCoefficient(), getNewAlignmentDiff(), getUDivExactExpr(), llvm::SCEVParameterRewriter::visitUDivExpr(), and llvm::SCEVApplyRewriter::visitUDivExpr().
Definition at line 3083 of file ScalarEvolution.cpp.
References llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
Referenced by getUMaxExpr(), getUMaxFromMismatchedTypes(), getUMinExpr(), llvm::SCEVParameterRewriter::visitUMaxExpr(), and llvm::SCEVApplyRewriter::visitUMaxExpr().
| const SCEV * ScalarEvolution::getUMaxExpr | ( | SmallVectorImpl< const SCEV * > & | Operands | ) |
Definition at line 3092 of file ScalarEvolution.cpp.
References llvm::BumpPtrAllocatorImpl< AllocatorT, SlabSize, SizeThreshold >::Allocate(), llvm::SmallVectorImpl< T >::append(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::SmallVectorImpl< T >::erase(), llvm::ConstantInt::get(), getConstant(), getContext(), getEffectiveSCEVType(), llvm::Intrinsic::getType(), getUMaxExpr(), GroupByComplexity(), llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_ULE, ID, isKnownPredicate(), llvm::scUMaxExpr, llvm::SmallVectorTemplateCommon< T >::size(), and llvm::APIntOps::umax().
getUMaxFromMismatchedTypes - Promote the operands to the wider of the types using zero-extension, and then perform a umax operation with them.
Definition at line 3476 of file ScalarEvolution.cpp.
References getNoopOrZeroExtend(), llvm::SCEV::getType(), getTypeSizeInBits(), getUMaxExpr(), and getZeroExtendExpr().
Definition at line 3193 of file ScalarEvolution.cpp.
References getNotSCEV(), and getUMaxExpr().
Referenced by getUMinFromMismatchedTypes().
getUMinFromMismatchedTypes - Promote the operands to the wider of the types using zero-extension, and then perform a umin operation with them.
Definition at line 3492 of file ScalarEvolution.cpp.
References getNoopOrZeroExtend(), llvm::SCEV::getType(), getTypeSizeInBits(), getUMinExpr(), and getZeroExtendExpr().
Definition at line 3219 of file ScalarEvolution.cpp.
References llvm::FoldingSetNodeID::AddInteger(), llvm::FoldingSetNodeID::AddPointer(), ID, llvm::FoldingSetNodeID::Intern(), SCEVUnknown, and llvm::scUnknown.
Referenced by llvm::SCEVParameterRewriter::visitUnknown().
|
inline |
getUnsignedRange - Determine the unsigned range for a particular SCEV.
Definition at line 863 of file ScalarEvolution.h.
Referenced by CanBeSMax(), CanBeSMin(), getUnsignedOverflowLimitForStep(), getZeroExtendExpr(), mustBeFiniteCountedLoop(), print(), and SimplifyICmpOperands().
Definition at line 1424 of file ScalarEvolution.cpp.
References llvm::FoldingSetNodeID::AddInteger(), llvm::FoldingSetNodeID::AddPointer(), llvm::ConstantRange::contains(), llvm::SCEV::FlagNUW, llvm::SCEV::FlagNW, llvm::IntegerType::get(), getAddExpr(), getAddRecExpr(), getConstant(), getContext(), getEffectiveSCEVType(), getMaxBackedgeTakenCount(), llvm::APInt::getMaxValue(), llvm::APInt::getMinValue(), getMulExpr(), getSignedRange(), getSignExtendExpr(), getTruncateOrZeroExtend(), llvm::SCEV::getType(), getTypeSizeInBits(), getUnsignedRange(), llvm::ConstantExpr::getZExt(), llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULT, ID, llvm::FoldingSetNodeID::Intern(), isKnownNegative(), isKnownPositive(), isLoopBackedgeGuardedByCond(), isLoopEntryGuardedByCond(), isSCEVable(), N, llvm::PPCISD::SC, llvm::scZeroExtend, llvm::AArch64DB::ST, llvm::ConstantRange::truncate(), llvm::ConstantRange::zeroExtend(), and llvm::ConstantRange::zextOrTrunc().
Referenced by getAnyExtendExpr(), getNoopOrZeroExtend(), getSignExtendExpr(), getTruncateOrZeroExtend(), getUDivExpr(), getUMaxFromMismatchedTypes(), getUMinFromMismatchedTypes(), IsIncrementNUW(), llvm::SCEVParameterRewriter::visitZeroExtendExpr(), and llvm::SCEVApplyRewriter::visitZeroExtendExpr().
hasComputableLoopEvolution - Return true if the given SCEV changes value in a known way in the specified loop.
This property being true implies that the value is variant in the loop AND that we can emit an expression to compute the value of the expression at any particular loop iteration.
Definition at line 8316 of file ScalarEvolution.cpp.
References getLoopDisposition(), and LoopComputable.
hasLoopInvariantBackedgeTakenCount - Return true if the specified loop has an analyzable loop-invariant backedge-taken count.
Definition at line 8116 of file ScalarEvolution.cpp.
References getBackedgeTakenCount().
Referenced by llvm::IVUsers::print(), and PrintLoopInfo().
hasOperand - Test whether the given SCEV has Op as a direct or indirect operand.
Definition at line 8427 of file ScalarEvolution.cpp.
References llvm::visitAll().
isKnownNegative - Test if the given expression is known to be negative.
Definition at line 6563 of file ScalarEvolution.cpp.
References llvm::ConstantRange::getSignedMax(), getSignedRange(), and llvm::APInt::isNegative().
Referenced by getSignedOverflowLimitForStep(), getZeroExtendExpr(), and isKnownNonZero().
isKnownNonNegative - Test if the given expression is known to be non-negative.
Definition at line 6571 of file ScalarEvolution.cpp.
References llvm::ConstantRange::getSignedMin(), getSignedRange(), and llvm::APInt::isNegative().
Referenced by getSignExtendExpr(), and StrengthenNoWrapFlags().
isKnownNonPositive - Test if the given expression is known to be non-positive.
Definition at line 6575 of file ScalarEvolution.cpp.
References llvm::ConstantRange::getSignedMax(), getSignedRange(), and llvm::APInt::isStrictlyPositive().
isKnownNonZero - Test if the given expression is known to be non-zero.
Definition at line 6579 of file ScalarEvolution.cpp.
References isKnownNegative(), and isKnownPositive().
isKnownPositive - Test if the given expression is known to be positive.
Definition at line 6567 of file ScalarEvolution.cpp.
References llvm::ConstantRange::getSignedMin(), getSignedRange(), and llvm::APInt::isStrictlyPositive().
Referenced by getPreStartForExtend(), getSignedOverflowLimitForStep(), getZeroExtendExpr(), and isKnownNonZero().
| bool ScalarEvolution::isKnownPredicate | ( | ICmpInst::Predicate | Pred, |
| const SCEV * | LHS, | ||
| const SCEV * | RHS | ||
| ) |
isKnownPredicate - Test if the given expression is known to satisfy the condition described by Pred, LHS, and RHS.
Definition at line 6583 of file ScalarEvolution.cpp.
References llvm::dyn_cast(), llvm::SCEVAddRecExpr::getLoop(), llvm::SCEVAddRecExpr::getPostIncExpr(), llvm::SCEVAddRecExpr::getStart(), isLoopBackedgeGuardedByCond(), isLoopEntryGuardedByCond(), and SimplifyICmpOperands().
Referenced by getSMaxExpr(), and getUMaxExpr().
| bool ScalarEvolution::isLoopBackedgeGuardedByCond | ( | const Loop * | L, |
| ICmpInst::Predicate | Pred, | ||
| const SCEV * | LHS, | ||
| const SCEV * | RHS | ||
| ) |
isLoopBackedgeGuardedByCond - Test whether the backedge of the loop is protected by a conditional between LHS and RHS.
This is used to to eliminate casts.
Definition at line 6697 of file ScalarEvolution.cpp.
References llvm::dyn_cast(), llvm::BranchInst::getCondition(), llvm::LoopBase< N, M >::getHeader(), llvm::DomTreeNodeBase< T >::getIDom(), llvm::LoopBase< N, M >::getLoopLatch(), llvm::BasicBlock::getSinglePredecessor(), llvm::BranchInst::getSuccessor(), llvm::BasicBlock::getTerminator(), llvm::BranchInst::isConditional(), and llvm::BasicBlockEdge::isSingleEdge().
Referenced by getSignExtendExpr(), getZeroExtendExpr(), and isKnownPredicate().
| bool ScalarEvolution::isLoopEntryGuardedByCond | ( | const Loop * | L, |
| ICmpInst::Predicate | Pred, | ||
| const SCEV * | LHS, | ||
| const SCEV * | RHS | ||
| ) |
isLoopEntryGuardedByCond - Test whether entry to the loop is protected by a conditional between LHS and RHS.
This is used to help avoid max expressions in loop trip counts, and to eliminate casts.
Definition at line 6796 of file ScalarEvolution.cpp.
References llvm::dyn_cast(), llvm::BranchInst::getCondition(), llvm::LoopBase< N, M >::getHeader(), llvm::LoopBase< N, M >::getLoopPredecessor(), llvm::BranchInst::getSuccessor(), and llvm::BranchInst::isUnconditional().
Referenced by getPreStartForExtend(), getSignExtendExpr(), getZeroExtendExpr(), and isKnownPredicate().
isLoopInvariant - Return true if the value of the given SCEV is unchanging in the specified loop.
Definition at line 8312 of file ScalarEvolution.cpp.
References getLoopDisposition(), and LoopInvariant.
Referenced by llvm::LoopAccessInfo::addRuntimeCheck(), genLoopLimit(), getAddExpr(), getAddRecExpr(), getMulExpr(), isLikelyComplexAddressComputation(), llvm::LoopAccessInfo::isUniform(), print(), SimplifyICmpOperands(), and llvm::stripGetElementPtr().
isSCEVable - Test if values of the given type are analyzable within the SCEV framework.
This primarily includes integer types, and it can optionally include pointer types if the ScalarEvolution class has access to target-specific information.
Definition at line 3249 of file ScalarEvolution.cpp.
References llvm::Type::isIntegerTy(), and llvm::Type::isPointerTy().
Referenced by llvm::IVUsers::AddUsersImpl(), findIVOperand(), FindLoopCounter(), getAnyExtendExpr(), getEffectiveSCEVType(), getSCEV(), getSignExtendExpr(), getTruncateExpr(), getTypeSizeInBits(), getZeroExtendExpr(), isExistingPhi(), isHighCostExpansion(), isSimpleIVUser(), and print().
|
inlinestatic |
Convenient NoWrapFlags manipulation that hides enum casts and is visible in the ScalarEvolution name space.
Definition at line 197 of file ScalarEvolution.h.
Referenced by getAddRecExpr(), getMinusSCEV(), getMulExpr(), and StrengthenNoWrapFlags().
|
overridevirtual |
print - Print out the internal state of the pass.
This is called by Analyze to print out the contents of an analysis. Otherwise it is not necessary to implement this method. Beware that the module pointer MAY be null. This automatically forwards to a virtual function that does not provide the Module* in case the analysis doesn't need it it can just be ignored.
Reimplemented from llvm::Pass.
Definition at line 8155 of file ScalarEvolution.cpp.
References llvm::LoopBase< N, M >::begin(), llvm::LoopBase< N, M >::end(), llvm::LoopBase< N, M >::getParentLoop(), getSCEV(), getSCEVAtScope(), getSignedRange(), getUnsignedRange(), I, llvm::inst_begin(), llvm::inst_end(), isLoopInvariant(), isSCEVable(), llvm::SCEV::print(), llvm::ConstantRange::print(), and PrintLoopInfo().
| bool ScalarEvolution::properlyDominates | ( | const SCEV * | S, |
| const BasicBlock * | BB | ||
| ) |
properlyDominates - Return true if elements that makes up the given SCEV properly dominate the specified basic block.
Definition at line 8406 of file ScalarEvolution.cpp.
References getBlockDisposition(), and ProperlyDominatesBlock.
Referenced by DoInitialMatch(), and SimplifyICmpOperands().
|
overridevirtual |
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memory when it is no longer needed.
The default behavior of passes is to hold onto memory for the entire duration of their lifetime (which is the entire compile time). For pipelined passes, this is not a big deal because that memory gets recycled every time the pass is invoked on another program unit. For IP passes, it is more important to free memory when it is unused.
Optionally implement this function to release pass memory when it is no longer used.
Reimplemented from llvm::Pass.
Definition at line 8077 of file ScalarEvolution.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::clear(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::clear(), llvm::DenseSet< ValueT, ValueInfoT >::empty(), I, and llvm::BumpPtrAllocatorImpl< AllocatorT, SlabSize, SizeThreshold >::Reset().
Referenced by verifyAnalysis().
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
Implements llvm::FunctionPass.
Definition at line 8068 of file ScalarEvolution.cpp.
|
inlinestatic |
Definition at line 201 of file ScalarEvolution.h.
Referenced by getAddExpr(), llvm::SCEVAddRecExpr::setNoWrapFlags(), and StrengthenNoWrapFlags().
| bool ScalarEvolution::SimplifyICmpOperands | ( | ICmpInst::Predicate & | Pred, |
| const SCEV *& | LHS, | ||
| const SCEV *& | RHS, | ||
| unsigned | Depth = 0 |
||
| ) |
SimplifyICmpOperands - Simplify LHS and RHS in a comparison with predicate Pred.
Return true iff any changes were made. If the operands are provably equal or unequal, LHS and RHS are set to the same value and Pred is set to either ICMP_EQ or ICMP_NE.
Return true iff any changes were made.
Definition at line 6286 of file ScalarEvolution.cpp.
References llvm::SCEV::FlagNSW, llvm::SCEV::FlagNUW, getAddExpr(), getConstant(), getContext(), llvm::ConstantInt::getFalse(), llvm::LoopBase< N, M >::getHeader(), llvm::ConstantExpr::getICmp(), llvm::ConstantRange::getSignedMax(), llvm::ConstantRange::getSignedMin(), getSignedRange(), llvm::CmpInst::getSwappedPredicate(), llvm::SCEV::getType(), llvm::ConstantRange::getUnsignedMax(), llvm::ConstantRange::getUnsignedMin(), getUnsignedRange(), HasSameValue(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, 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::isFalseWhenEqual(), isLoopInvariant(), llvm::APInt::isMaxSignedValue(), llvm::APInt::isMaxValue(), llvm::APInt::isMinSignedValue(), llvm::APInt::isMinValue(), llvm::CmpInst::isTrueWhenEqual(), llvm_unreachable, properlyDominates(), and std::swap().
Referenced by isKnownPredicate().
|
overridevirtual |
verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis information.
Reimplemented from llvm::Pass.
Definition at line 8485 of file ScalarEvolution.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::begin(), llvm::dbgs(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), getLoopBackedgeTakenCounts(), I, llvm::LoopBase< N, M >::rbegin(), releaseMemory(), llvm::LoopBase< N, M >::rend(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::size(), and VerifySCEV.
|
friend |
Definition at line 220 of file ScalarEvolution.h.
Referenced by getSCEV().
|
friend |
Definition at line 221 of file ScalarEvolution.h.
|
friend |
Definition at line 222 of file ScalarEvolution.h.
Referenced by getUnknown().
|
static |
Definition at line 582 of file ScalarEvolution.h.
Referenced by getAddExpr(), getAddRecExpr(), getConstant(), getMulExpr(), getSignExtendExpr(), getSMaxExpr(), getTruncateExpr(), getUDivExpr(), getUMaxExpr(), getUnknown(), and getZeroExtendExpr().
1.8.6