LLVM 22.0.0git
Public Member Functions | List of all members
llvm::PredicatedScalarEvolution Class Reference

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

LLVM_ABI PredicatedScalarEvolution (ScalarEvolution &SE, Loop &L)
 
LLVM_ABI const SCEVPredicategetPredicate () const
 
LLVM_ABI const SCEVgetSCEV (Value *V)
 Returns the SCEV expression of V, in the context of the current SCEV predicate.
 
LLVM_ABI const SCEVgetBackedgeTakenCount ()
 Get the (predicated) backedge count for the analyzed loop.
 
LLVM_ABI const SCEVgetSymbolicMaxBackedgeTakenCount ()
 Get the (predicated) symbolic max backedge count for the analyzed loop.
 
LLVM_ABI unsigned getSmallConstantMaxTripCount ()
 Returns the upper bound of the loop trip count as a normal unsigned value, or 0 if the trip count is unknown.
 
LLVM_ABI void addPredicate (const SCEVPredicate &Pred)
 Adds a new predicate.
 
LLVM_ABI const SCEVAddRecExprgetAsAddRec (Value *V)
 Attempts to produce an AddRecExpr for V by adding additional SCEV predicates.
 
LLVM_ABI void setNoOverflow (Value *V, SCEVWrapPredicate::IncrementWrapFlags Flags)
 Proves that V doesn't overflow by adding SCEV predicate.
 
LLVM_ABI bool hasNoOverflow (Value *V, SCEVWrapPredicate::IncrementWrapFlags Flags)
 Returns true if we've proved that V doesn't wrap by means of a SCEV predicate.
 
ScalarEvolutiongetSE () const
 Returns the ScalarEvolution analysis used.
 
LLVM_ABI PredicatedScalarEvolution (const PredicatedScalarEvolution &)
 We need to explicitly define the copy constructor because of FlagsMap.
 
LLVM_ABI void print (raw_ostream &OS, unsigned Depth) const
 Print the SCEV mappings done by the Predicated Scalar Evolution.
 
LLVM_ABI bool areAddRecsEqualWithPreds (const SCEVAddRecExpr *AR1, const SCEVAddRecExpr *AR2) const
 Check if AR1 and AR2 are equal, while taking into account Equal predicates in Preds.
 

Detailed Description

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 2423 of file ScalarEvolution.h.

Constructor & Destructor Documentation

◆ PredicatedScalarEvolution() [1/2]

PredicatedScalarEvolution::PredicatedScalarEvolution ( ScalarEvolution SE,
Loop L 
)

Definition at line 15187 of file ScalarEvolution.cpp.

◆ PredicatedScalarEvolution() [2/2]

PredicatedScalarEvolution::PredicatedScalarEvolution ( const PredicatedScalarEvolution Init)

We need to explicitly define the copy constructor because of FlagsMap.

Definition at line 15325 of file ScalarEvolution.cpp.

References I.

Member Function Documentation

◆ addPredicate()

void PredicatedScalarEvolution::addPredicate ( const SCEVPredicate Pred)

◆ areAddRecsEqualWithPreds()

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 5728 of file ScalarEvolution.cpp.

References llvm::ScalarEvolution::getEqualPredicate(), llvm::SCEVAddRecExpr::getStart(), and llvm::SCEVAddRecExpr::getStepRecurrence().

Referenced by getCastsForInductionPHI().

◆ getAsAddRec()

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 15310 of file ScalarEvolution.cpp.

References addPredicate(), llvm::ScalarEvolution::convertSCEVToAddRecWithPredicates(), llvm::ScalarEvolution::getSCEV(), getSCEV(), and P.

Referenced by llvm::getPtrStride(), and llvm::InductionDescriptor::isInductionPHI().

◆ getBackedgeTakenCount()

const SCEV * PredicatedScalarEvolution::getBackedgeTakenCount ( )

◆ getPredicate()

const SCEVPredicate & PredicatedScalarEvolution::getPredicate ( ) const

◆ getSCEV()

const SCEV * PredicatedScalarEvolution::getSCEV ( Value V)

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 15204 of file ScalarEvolution.cpp.

References llvm::ScalarEvolution::getSCEV(), and llvm::ScalarEvolution::rewriteUsingPredicate().

Referenced by getAddressAccessSCEV(), getAsAddRec(), getCastsForInductionPHI(), llvm::LoopVectorizationCostModel::getInstructionCost(), hasNoOverflow(), llvm::InductionDescriptor::isInductionPHI(), llvm::replaceSymbolicStrideSCEV(), setNoOverflow(), and llvm::LoopVectorizationCostModel::setVectorizedCallDecision().

◆ getSE()

ScalarEvolution * llvm::PredicatedScalarEvolution::getSE ( ) const
inline

◆ getSmallConstantMaxTripCount()

unsigned PredicatedScalarEvolution::getSmallConstantMaxTripCount ( )

Returns the upper bound of the loop trip count as a normal unsigned value, or 0 if the trip count is unknown.

Definition at line 15244 of file ScalarEvolution.cpp.

References addPredicate(), llvm::ScalarEvolution::getSmallConstantMaxTripCount(), and P.

Referenced by llvm::LoopVectorizationCostModel::computeMaxVF(), and getSmallBestKnownTC().

◆ getSymbolicMaxBackedgeTakenCount()

const SCEV * PredicatedScalarEvolution::getSymbolicMaxBackedgeTakenCount ( )

Get the (predicated) symbolic max backedge count for the analyzed loop.

Definition at line 15233 of file ScalarEvolution.cpp.

References addPredicate(), llvm::ScalarEvolution::getPredicatedSymbolicMaxBackedgeTakenCount(), and P.

Referenced by addInitialSkeleton(), llvm::LoopVectorizationCostModel::computeMaxVF(), and llvm::RuntimePointerChecking::insert().

◆ hasNoOverflow()

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 15294 of file ScalarEvolution.cpp.

References llvm::SCEVWrapPredicate::clearFlags(), llvm::SCEVWrapPredicate::getImpliedFlags(), getSCEV(), II, and llvm::SCEVWrapPredicate::IncrementAnyWrap.

Referenced by isNoWrap().

◆ print()

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 15335 of file ScalarEvolution.cpp.

References llvm::Depth, llvm::ScalarEvolution::getSCEV(), I, II, llvm::raw_ostream::indent(), llvm::ScalarEvolution::isSCEVable(), and OS.

Referenced by llvm::LoopAccessInfo::print().

◆ setNoOverflow()

void PredicatedScalarEvolution::setNoOverflow ( Value V,
SCEVWrapPredicate::IncrementWrapFlags  Flags 
)

The documentation for this class was generated from the following files: