LLVM 17.0.0git
|
An interface layer with SCEV used to manage how we see SCEV expressions for values in the context of existing predicates. More...
#include "llvm/Analysis/ScalarEvolution.h"
Public Member Functions | |
PredicatedScalarEvolution (ScalarEvolution &SE, Loop &L) | |
const SCEVPredicate & | getPredicate () const |
const SCEV * | getSCEV (Value *V) |
Returns the SCEV expression of V, in the context of the current SCEV predicate. | |
const SCEV * | getBackedgeTakenCount () |
Get the (predicated) backedge count for the analyzed loop. | |
void | addPredicate (const SCEVPredicate &Pred) |
Adds a new predicate. | |
const SCEVAddRecExpr * | getAsAddRec (Value *V) |
Attempts to produce an AddRecExpr for V by adding additional SCEV predicates. | |
void | setNoOverflow (Value *V, SCEVWrapPredicate::IncrementWrapFlags Flags) |
Proves that V doesn't overflow by adding SCEV predicate. | |
bool | hasNoOverflow (Value *V, SCEVWrapPredicate::IncrementWrapFlags Flags) |
Returns true if we've proved that V doesn't wrap by means of a SCEV predicate. | |
ScalarEvolution * | getSE () const |
Returns the ScalarEvolution analysis used. | |
PredicatedScalarEvolution (const PredicatedScalarEvolution &) | |
We need to explicitly define the copy constructor because of FlagsMap. | |
void | print (raw_ostream &OS, unsigned Depth) const |
Print the SCEV mappings done by the Predicated Scalar Evolution. | |
bool | areAddRecsEqualWithPreds (const SCEVAddRecExpr *AR1, const SCEVAddRecExpr *AR2) const |
Check if AR1 and AR2 are equal, while taking into account Equal predicates in Preds. | |
An interface layer with SCEV used to manage how we see SCEV expressions for values in the context of existing predicates.
We can add new predicates, but we cannot remove them.
This layer has multiple purposes:
Definition at line 2310 of file ScalarEvolution.h.
PredicatedScalarEvolution::PredicatedScalarEvolution | ( | ScalarEvolution & | SE, |
Loop & | L | ||
) |
Definition at line 14707 of file ScalarEvolution.cpp.
References llvm::Empty.
PredicatedScalarEvolution::PredicatedScalarEvolution | ( | const PredicatedScalarEvolution & | Init | ) |
We need to explicitly define the copy constructor because of FlagsMap.
Definition at line 14825 of file ScalarEvolution.cpp.
References I.
void PredicatedScalarEvolution::addPredicate | ( | const SCEVPredicate & | Pred | ) |
Adds a new predicate.
Definition at line 14753 of file ScalarEvolution.cpp.
References llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by getAsAddRec(), getBackedgeTakenCount(), llvm::replaceSymbolicStrideSCEV(), and setNoOverflow().
bool PredicatedScalarEvolution::areAddRecsEqualWithPreds | ( | const SCEVAddRecExpr * | AR1, |
const SCEVAddRecExpr * | AR2 | ||
) | const |
Check if AR1
and AR2
are equal, while taking into account Equal predicates in Preds.
Definition at line 5664 of file ScalarEvolution.cpp.
References llvm::ScalarEvolution::getEqualPredicate(), llvm::SCEVAddRecExpr::getStart(), and llvm::SCEVAddRecExpr::getStepRecurrence().
Referenced by getCastsForInductionPHI().
const SCEVAddRecExpr * PredicatedScalarEvolution::getAsAddRec | ( | Value * | V | ) |
Attempts to produce an AddRecExpr for V by adding additional SCEV predicates.
If we can't transform the expression into an AddRecExpr we return nullptr and not add additional SCEV predicates to the current context.
Definition at line 14810 of file ScalarEvolution.cpp.
References addPredicate(), llvm::ScalarEvolution::convertSCEVToAddRecWithPredicates(), llvm::ScalarEvolution::getSCEV(), getSCEV(), and P.
Referenced by llvm::getPtrStride(), hasComputableBounds(), and llvm::InductionDescriptor::isInductionPHI().
Get the (predicated) backedge count for the analyzed loop.
Definition at line 14743 of file ScalarEvolution.cpp.
References addPredicate(), llvm::ScalarEvolution::getPredicatedBackedgeTakenCount(), and P.
Referenced by llvm::LoopVectorizationCostModel::computeMaxVF(), llvm::createTripCountSCEV(), llvm::RuntimePointerChecking::insert(), and processLoopInVPlanNativePath().
const SCEVPredicate & PredicatedScalarEvolution::getPredicate | ( | ) | const |
Definition at line 14764 of file ScalarEvolution.cpp.
Referenced by llvm::LoopVectorizationLegality::canVectorize(), llvm::LoopAccessInfo::print(), llvm::LoopVectorizePass::processLoop(), and llvm::LoopVectorizationCostModel::runtimeChecksRequired().
Returns the SCEV expression of V, in the context of the current SCEV predicate.
The order of transformations applied on the expression of V returned by ScalarEvolution is guaranteed to be preserved, even when adding new predicates.
Definition at line 14724 of file ScalarEvolution.cpp.
References llvm::ScalarEvolution::getSCEV(), and llvm::ScalarEvolution::rewriteUsingPredicate().
Referenced by getAddressAccessSCEV(), getAsAddRec(), getCastsForInductionPHI(), hasNoOverflow(), llvm::InductionDescriptor::isInductionPHI(), isNoWrap(), isNoWrapAddRec(), llvm::replaceSymbolicStrideSCEV(), and setNoOverflow().
|
inline |
Returns the ScalarEvolution analysis used.
Definition at line 2342 of file ScalarEvolution.h.
Referenced by llvm::InterleavedAccessInfo::analyzeInterleaving(), canTailPredicateLoop(), llvm::LoopVectorizationCostModel::computeMaxVF(), llvm::createTripCountSCEV(), llvm::LoopVectorizationPlanner::executePlan(), findForkedPointer(), llvm::InnerLoopVectorizer::fixVectorizedLoop(), getAddressAccessSCEV(), llvm::getPtrStride(), llvm::LoopVectorizationLegality::getScalarEvolution(), hasComputableBounds(), llvm::RuntimePointerChecking::insert(), llvm::InductionDescriptor::isInductionPHI(), llvm::LoopAccessInfo::isInvariant(), llvm::LoopVectorizationLegality::isInvariantAddressOfReduction(), isNoWrap(), llvm::LoopVectorizationLegality::isUniform(), llvm::VPlanTransforms::optimizeForVFAndUF(), llvm::LoopVectorizePass::processLoop(), processLoopInVPlanNativePath(), llvm::replaceSymbolicStrideSCEV(), and llvm::LoopVectorizationCostModel::selectInterleaveCount().
bool PredicatedScalarEvolution::hasNoOverflow | ( | Value * | V, |
SCEVWrapPredicate::IncrementWrapFlags | Flags | ||
) |
Returns true if we've proved that V doesn't wrap by means of a SCEV predicate.
Definition at line 14794 of file ScalarEvolution.cpp.
References llvm::SCEVWrapPredicate::clearFlags(), Flags, llvm::SCEVWrapPredicate::getImpliedFlags(), getSCEV(), and llvm::SCEVWrapPredicate::IncrementAnyWrap.
Referenced by isNoWrap(), and isNoWrapAddRec().
void PredicatedScalarEvolution::print | ( | raw_ostream & | OS, |
unsigned | Depth | ||
) | const |
Print the SCEV mappings done by the Predicated Scalar Evolution.
The printed text is indented by Depth
.
Definition at line 14834 of file ScalarEvolution.cpp.
References llvm::Depth, llvm::ScalarEvolution::getSCEV(), I, llvm::raw_ostream::indent(), llvm::ScalarEvolution::isSCEVable(), and OS.
Referenced by llvm::LoopAccessInfo::print().
void PredicatedScalarEvolution::setNoOverflow | ( | Value * | V, |
SCEVWrapPredicate::IncrementWrapFlags | Flags | ||
) |
Proves that V doesn't overflow by adding SCEV predicate.
Definition at line 14778 of file ScalarEvolution.cpp.
References addPredicate(), llvm::SCEVWrapPredicate::clearFlags(), Flags, llvm::SCEVWrapPredicate::getImpliedFlags(), getSCEV(), llvm::ScalarEvolution::getWrapPredicate(), and llvm::SCEVWrapPredicate::setFlags().
Referenced by llvm::getPtrStride().