LLVM
8.0.1
|
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 SCEVUnionPredicate & | getUnionPredicate () const |
const SCEV * | getSCEV (Value *V) |
Returns the SCEV expression of V, in the context of the current SCEV predicate. More... | |
const SCEV * | getBackedgeTakenCount () |
Get the (predicated) backedge count for the analyzed loop. More... | |
void | addPredicate (const SCEVPredicate &Pred) |
Adds a new predicate. More... | |
const SCEVAddRecExpr * | getAsAddRec (Value *V) |
Attempts to produce an AddRecExpr for V by adding additional SCEV predicates. More... | |
void | setNoOverflow (Value *V, SCEVWrapPredicate::IncrementWrapFlags Flags) |
Proves that V doesn't overflow by adding SCEV predicate. More... | |
bool | hasNoOverflow (Value *V, SCEVWrapPredicate::IncrementWrapFlags Flags) |
Returns true if we've proved that V doesn't wrap by means of a SCEV predicate. More... | |
ScalarEvolution * | getSE () const |
Returns the ScalarEvolution analysis used. More... | |
PredicatedScalarEvolution (const PredicatedScalarEvolution &) | |
We need to explicitly define the copy constructor because of FlagsMap. More... | |
void | print (raw_ostream &OS, unsigned Depth) const |
Print the SCEV mappings done by the Predicated Scalar Evolution. More... | |
bool | areAddRecsEqualWithPreds (const SCEVAddRecExpr *AR1, const SCEVAddRecExpr *AR2) const |
Check if AR1 and AR2 are equal, while taking into account Equal predicates in Preds. More... | |
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 1931 of file ScalarEvolution.h.
PredicatedScalarEvolution::PredicatedScalarEvolution | ( | ScalarEvolution & | SE, |
Loop & | L | ||
) |
Definition at line 12283 of file ScalarEvolution.cpp.
PredicatedScalarEvolution::PredicatedScalarEvolution | ( | const PredicatedScalarEvolution & | Init | ) |
We need to explicitly define the copy constructor because of FlagsMap.
Definition at line 12384 of file ScalarEvolution.cpp.
References I.
void PredicatedScalarEvolution::addPredicate | ( | const SCEVPredicate & | Pred | ) |
Adds a new predicate.
Definition at line 12315 of file ScalarEvolution.cpp.
References llvm::SCEVUnionPredicate::add(), and llvm::SCEVUnionPredicate::implies().
Referenced by 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 4949 of file ScalarEvolution.cpp.
References llvm::MCID::Add, assert(), llvm::LoopBase< BlockT, LoopT >::contains(), llvm::SCEV::FlagAnyWrap, llvm::SCEV::FlagNSW, llvm::SCEV::FlagNUW, llvm::SCEV::FlagNW, GEP, llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::PHINode::getNumIncomingValues(), llvm::Instruction::getParent(), llvm::SCEVAddRecExpr::getStart(), llvm::SCEVAddRecExpr::getStepRecurrence(), llvm::isKnownPositive(), llvm::Loop::isLoopInvariant(), isLoopInvariant(), MatchBinaryOp(), and llvm::SmallVectorTemplateBase< T >::push_back().
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 12368 of file ScalarEvolution.cpp.
References llvm::SCEVUnionPredicate::add(), 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 12306 of file ScalarEvolution.cpp.
References addPredicate(), and llvm::ScalarEvolution::getPredicatedBackedgeTakenCount().
Referenced by llvm::InnerLoopVectorizer::getOrCreateTripCount(), and llvm::RuntimePointerChecking::insert().
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 12287 of file ScalarEvolution.cpp.
References llvm::ScalarEvolution::getSCEV(), and llvm::ScalarEvolution::rewriteUsingPredicate().
Referenced by getAddressAccessSCEV(), getAsAddRec(), getCastsForInductionPHI(), hasNoOverflow(), llvm::InductionDescriptor::isInductionPHI(), isLoadConditional(), isNoWrap(), isNoWrapAddRec(), llvm::replaceSymbolicStrideSCEV(), setNoOverflow(), and llvm::InnerLoopVectorizer::widenInstruction().
|
inline |
Returns the ScalarEvolution analysis used.
Definition at line 1963 of file ScalarEvolution.h.
References llvm::Depth, and llvm::SCEV::print().
Referenced by llvm::LoopVectorizationCostModel::computeMaxVF(), llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), llvm::InnerLoopVectorizer::emitMemRuntimeChecks(), llvm::InnerLoopVectorizer::emitSCEVChecks(), llvm::InnerLoopVectorizer::fixupIVUsers(), getAddressAccessSCEV(), llvm::InnerLoopVectorizer::getOrCreateTripCount(), llvm::getPtrStride(), hasComputableBounds(), llvm::RuntimePointerChecking::insert(), llvm::InductionDescriptor::isInductionPHI(), isLoadConditional(), isNoWrap(), isStrideMul(), llvm::replaceSymbolicStrideSCEV(), llvm::LoopVectorizationCostModel::selectInterleaveCount(), llvm::LoopVectorizationCostModel::setCostBasedWideningDecision(), llvm::InnerLoopVectorizer::updateAnalysis(), llvm::InnerLoopVectorizer::widenInstruction(), llvm::InnerLoopVectorizer::widenIntOrFpInduction(), and llvm::InnerLoopVectorizer::widenPHIInstruction().
const SCEVUnionPredicate & PredicatedScalarEvolution::getUnionPredicate | ( | ) | const |
Definition at line 12322 of file ScalarEvolution.cpp.
References llvm::ScalarEvolution::rewriteUsingPredicate().
Referenced by llvm::LoopVersioning::annotateInstWithNoAlias(), llvm::LoopVectorizationCostModel::computeMaxVF(), llvm::InnerLoopVectorizer::emitSCEVChecks(), isLoadConditional(), llvm::LoopVersioning::LoopVersioning(), and llvm::LoopVersioning::versionLoop().
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 12352 of file ScalarEvolution.cpp.
References llvm::SCEVWrapPredicate::clearFlags(), llvm::SCEVWrapPredicate::getImpliedFlags(), getSCEV(), and llvm::SCEVWrapPredicate::IncrementAnyWrap.
Referenced by llvm::getPtrStride(), and isNoWrap().
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 12392 of file ScalarEvolution.cpp.
References llvm::MCID::Add, B, llvm::dyn_cast(), llvm::LoopBase< BlockT, LoopT >::getBlocks(), llvm::ScalarEvolution::getSCEV(), I, llvm::raw_ostream::indent(), and llvm::ScalarEvolution::isSCEVable().
void PredicatedScalarEvolution::setNoOverflow | ( | Value * | V, |
SCEVWrapPredicate::IncrementWrapFlags | Flags | ||
) |
Proves that V doesn't overflow by adding SCEV predicate.
Definition at line 12336 of file ScalarEvolution.cpp.
References addPredicate(), llvm::SCEVWrapPredicate::clearFlags(), llvm::SCEVWrapPredicate::getImpliedFlags(), getSCEV(), llvm::ScalarEvolution::getWrapPredicate(), and llvm::SCEVWrapPredicate::setFlags().
Referenced by llvm::getPtrStride().