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.

Synopsis

Declared in <llvm/Analysis/ScalarEvolution.h>

class PredicatedScalarEvolution;

Description

This layer has multiple purposes:

  • provides a simple interface for SCEV versioning.

  • guarantees that the order of transformations applied on a SCEV expression for a single Value is consistent across two different getSCEV calls. This means that, for example, once we've obtained an AddRec expression for a certain value through expression rewriting, we will continue to get an AddRec expression for that Value.

  • lowers the number of expression rewrites.

Member Functions

Name

Description

PredicatedScalarEvolution [constructor]

We need to explicitly define the copy constructor due to the ownership of the SCEVUnionPredicate Preds.

addPredicate

Adds a new predicate.

addPredicates

Adds all predicates in Preds.

areAddRecsEqualWithPreds

Check if AR1 and AR2 are equal, while taking into account Equal predicates in Preds and ExtraPreds.

getAsAddRec

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. If WrapPredsAdded is non‐null, the required predicates are collected there instead of being added to this context.

getBackedgeTakenCount

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

getPredicate

getPredicatedSCEV

Returns the rewritten SCEV for Expr in the context of the current SCEV predicate. The order of transformations applied on the expression of Expr returned by ScalarEvolution is guaranteed to be preserved, even when adding new predicates.

getSCEV

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.

getSE

Returns the ScalarEvolution analysis used.

getSmallConstantMaxTripCount

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

getSymbolicMaxBackedgeTakenCount

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

hasNoOverflow

Returns true if we've statically proved that V doesn't wrap.

print

Print the SCEV mappings done by the Predicated Scalar Evolution. The printed text is indented by Depth.

Non-Member Functions

Name

Description

getPtrStride

If the pointer has a constant stride return it in units of the access type size. If the pointer is loop‐invariant, return 0. Otherwise return std::nullopt.

getPtrStride

Overload of getPtrStride that adds the no‐wrap predicates directly to PSE. The Assume parameter indicates whether such additional run‐time assumptions are allowed.

replaceSymbolicStrideSCEV

Return the SCEV corresponding to a pointer with the symbolic stride replaced with constant one, assuming the SCEV predicate associated with PSE is true.

Created with MrDocs