[#llvm-SCEVExpander] = xref:llvm.adoc[llvm]::SCEVExpander :relfileprefix: ../ :mrdocs: This class uses information about analyze scalars to rewrite expressions in canonical form. == Synopsis Declared in `<llvm/Transforms/Utils/ScalarEvolutionExpander.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class SCEVExpander : public xref:llvm/SCEVUseVisitor-00.adoc[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 [cols="1,4"] |=== | Name| Description | `xref:llvm/SCEVUseVisitor-00.adoc[SCEVUseVisitor<SCEVExpander, Value*>]` | A visitor class for SCEVUse. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:llvm/SCEVExpander/2constructor.adoc[`SCEVExpander`] [.small]#[constructor]# | Construct a SCEVExpander in "canonical" mode. | xref:llvm/SCEVExpander/2destructor.adoc[`~SCEVExpander`] [.small]#[destructor]# | Destroy the expander and assert that insert‐point guards were balanced. | xref:llvm/SCEVExpander/SetCurrentDebugLocation.adoc[`SetCurrentDebugLocation`] | Set location information used by debugging information. | xref:llvm/SCEVExpander/clear.adoc[`clear`] | Clear cached expansions and inserted‐value tracking. | xref:llvm/SCEVExpander/clearInsertPoint.adoc[`clearInsertPoint`] | Clear the current insertion point. This is useful if the instruction that had been serving as the insertion point may have been deleted. | xref:llvm/SCEVExpander/clearPostInc.adoc[`clearPostInc`] | Disable all post‐inc expansion. | xref:llvm/SCEVExpander/disableCanonicalMode.adoc[`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. | xref:llvm/SCEVExpander/enableLSRMode.adoc[`enableLSRMode`] | Enable strength‐reduction mode for loop strength reduction. | xref:llvm/SCEVExpander/eraseDeadInstructions.adoc[`eraseDeadInstructions`] | Remove inserted instructions that are dead, e.g. due to InstSimplifyFolder simplifications. `Root` is assumed to be used and won't be removed. | xref:llvm/SCEVExpander/expandCodeFor-04.adoc[`expandCodeFor`] | `expandCodeFor` overloads | xref:llvm/SCEVExpander/expandCodeForPredicate.adoc[`expandCodeForPredicate`] | Expand `Pred` to an i1 value inserted at `Loc.` | xref:llvm/SCEVExpander/expandComparePredicate.adoc[`expandComparePredicate`] | A specialized variant of expandCodeForPredicate, handling the case when we are expanding code for a SCEVComparePredicate. | xref:llvm/SCEVExpander/expandUnionPredicate.adoc[`expandUnionPredicate`] | A specialized variant of expandCodeForPredicate, handling the case when we are expanding code for a SCEVUnionPredicate. | xref:llvm/SCEVExpander/expandWrapPredicate.adoc[`expandWrapPredicate`] | A specialized variant of expandCodeForPredicate, handling the case when we are expanding code for a SCEVWrapPredicate. | xref:llvm/SCEVExpander/findInsertPointAfter.adoc[`findInsertPointAfter`] | Returns a suitable insert point after `I,` that dominates `MustDominate.` Skips instructions inserted by the expander. | xref:llvm/SCEVExpander/generateOverflowCheck.adoc[`generateOverflowCheck`] | Generates code that evaluates if the `AR` expression will overflow. | xref:llvm/SCEVExpander/getAllInsertedInstructions.adoc[`getAllInsertedInstructions`] | Return a vector containing all instructions inserted during expansion. | xref:llvm/SCEVExpander/getCurrentDebugLocation.adoc[`getCurrentDebugLocation`] | Get location information used by debugging information. | xref:llvm/SCEVExpander/getIVIncOperand.adoc[`getIVIncOperand`] | Return the induction variable increment's IV operand. | xref:llvm/SCEVExpander/getInsertedIVs.adoc[`getInsertedIVs`] | Return the induction variables created during expansion. | xref:llvm/SCEVExpander/getSE.adoc[`getSE`] | Return the ScalarEvolution instance used by this expander. | xref:llvm/SCEVExpander/hasRelatedExistingExpansion.adoc[`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. | xref:llvm/SCEVExpander/hoistIVInc.adoc[`hoistIVInc`] | Hoist `IncV` and its required subexpressions before `InsertPos.` | xref:llvm/SCEVExpander/isHighCostExpansion.adoc[`isHighCostExpansion`] | Return true for expressions that can't be evaluated at runtime within given *Budget.* | xref:llvm/SCEVExpander/isInsertedInstruction.adoc[`isInsertedInstruction`] | Return true if the specified instruction was inserted by the code rewriter. | xref:llvm/SCEVExpander/isSafeToExpand.adoc[`isSafeToExpand`] | Return true if `S` is safe to expand anywhere its operands are defined. | xref:llvm/SCEVExpander/isSafeToExpandAt.adoc[`isSafeToExpandAt`] | Return true if `S` is safe to expand at `InsertionPoint.` | xref:llvm/SCEVExpander/replaceCongruentIVs.adoc[`replaceCongruentIVs`] | replace congruent phis with their most canonical representative. Return the number of phis eliminated. | xref:llvm/SCEVExpander/setChainedPhi.adoc[`setChainedPhi`] | Record `PN` as completing an IV chain so it can be reused. | xref:llvm/SCEVExpander/setIVIncInsertPos.adoc[`setIVIncInsertPos`] | Set the current IV increment loop and position. | xref:llvm/SCEVExpander/setInsertPoint-06.adoc[`setInsertPoint`] | `setInsertPoint` overloads | xref:llvm/SCEVExpander/setPostInc.adoc[`setPostInc`] | Enable post‐inc expansion for addrecs referring to the given loops. Post‐inc expansion is only supported in non‐canonical mode. | xref:llvm/SCEVExpander/visit.adoc[`visit`] | Dispatch to the typed visit method for SCEVUse `S.` | xref:llvm/SCEVExpander/visitCouldNotCompute.adoc[`visitCouldNotCompute`] | Default handler for SCEVCouldNotCompute uses; aborts on use. |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:llvm/SCEVExpander/canReuseFlagsFromOriginalIVInc.adoc[`canReuseFlagsFromOriginalIVInc`] | Return true if original and wide IV increments can share poison flags. | xref:llvm/SCEVExpander/dropPoisonGeneratingAnnotationsAndReinfer.adoc[`dropPoisonGeneratingAnnotationsAndReinfer`] | Drop poison‐generating flags from `I,` then try re‐infer via SCEV. | xref:llvm/SCEVExpander/findReusableCastForPtrToAddr.adoc[`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 [cols="1,4"] |=== | Name| Description | `xref:llvm/SCEVUseVisitor-00.adoc[llvm::SCEVUseVisitor]` | A visitor class for SCEVUse. | `xref:llvm/SCEVExpanderCleaner.adoc[llvm::SCEVExpanderCleaner]` | Helper to remove instructions inserted during SCEV expansion, unless they are marked as used. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#