This class uses information about analyze scalars to rewrite expressions in canonical form.

Synopsis

Declared in <llvm/Transforms/Utils/ScalarEvolutionExpander.h>

class SCEVExpander
    : public SCEVUseVisitor<SCEVExpander, Value*>

Description

Clients should create an instance of this class when rewriting is needed, and destroy it when finished to allow the release of the associated memory.

Base Classes

Name

Description

SCEVUseVisitor<SCEVExpander, Value*>

A visitor class for SCEVUse.

Member Functions

Name

Description

SCEVExpander [constructor]

Construct a SCEVExpander in "canonical" mode.

~SCEVExpander [destructor]

Destroy the expander and assert that insert‐point guards were balanced.

SetCurrentDebugLocation

Set location information used by debugging information.

clear

Clear cached expansions and inserted‐value tracking.

clearInsertPoint

Clear the current insertion point. This is useful if the instruction that had been serving as the insertion point may have been deleted.

clearPostInc

Disable all post‐inc expansion.

disableCanonicalMode

Disable the behavior of expanding expressions in canonical form rather than in a more literal form. Non‐canonical mode is useful for late optimization passes.

enableLSRMode

Enable strength‐reduction mode for loop strength reduction.

eraseDeadInstructions

Remove inserted instructions that are dead, e.g. due to InstSimplifyFolder simplifications. Root is assumed to be used and won't be removed.

expandCodeFor

expandCodeFor overloads

expandCodeForPredicate

Expand Pred to an i1 value inserted at Loc.

expandComparePredicate

A specialized variant of expandCodeForPredicate, handling the case when we are expanding code for a SCEVComparePredicate.

expandUnionPredicate

A specialized variant of expandCodeForPredicate, handling the case when we are expanding code for a SCEVUnionPredicate.

expandWrapPredicate

A specialized variant of expandCodeForPredicate, handling the case when we are expanding code for a SCEVWrapPredicate.

findInsertPointAfter

Returns a suitable insert point after I, that dominates MustDominate. Skips instructions inserted by the expander.

generateOverflowCheck

Generates code that evaluates if the AR expression will overflow.

getAllInsertedInstructions

Return a vector containing all instructions inserted during expansion.

getCurrentDebugLocation

Get location information used by debugging information.

getIVIncOperand

Return the induction variable increment's IV operand.

getInsertedIVs

Return the induction variables created during expansion.

getSE

Return the ScalarEvolution instance used by this expander.

hasRelatedExistingExpansion

Determine whether there is an existing expansion of S that can be reused. This is used to check whether S can be expanded cheaply.

hoistIVInc

Hoist IncV and its required subexpressions before InsertPos.

isHighCostExpansion

Return true for expressions that can't be evaluated at runtime within given Budget.

isInsertedInstruction

Return true if the specified instruction was inserted by the code rewriter.

isSafeToExpand

Return true if S is safe to expand anywhere its operands are defined.

isSafeToExpandAt

Return true if S is safe to expand at InsertionPoint.

replaceCongruentIVs

replace congruent phis with their most canonical representative. Return the number of phis eliminated.

setChainedPhi

Record PN as completing an IV chain so it can be reused.

setIVIncInsertPos

Set the current IV increment loop and position.

setInsertPoint

setInsertPoint overloads

setPostInc

Enable post‐inc expansion for addrecs referring to the given loops. Post‐inc expansion is only supported in non‐canonical mode.

visit

Dispatch to the typed visit method for SCEVUse S.

visitCouldNotCompute

Default handler for SCEVCouldNotCompute uses; aborts on use.

Static Member Functions

Name

Description

canReuseFlagsFromOriginalIVInc

Return true if original and wide IV increments can share poison flags.

dropPoisonGeneratingAnnotationsAndReinfer

Drop poison‐generating flags from I, then try re‐infer via SCEV.

findReusableCastForPtrToAddr

Find an existing cast among PtrOp's users that computes the same value as a ptrtoaddr of PtrOp to Ty and can be reused when expanding ptrtoaddr.

Friends

Name

Description

llvm::SCEVUseVisitor

A visitor class for SCEVUse.

llvm::SCEVExpanderCleaner

Helper to remove instructions inserted during SCEV expansion, unless they are marked as used.

Created with MrDocs