llvm::sinkRegion

Sink invariant instructions out of a loop region in reverse DFS order.

Synopsis

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

bool
sinkRegion(
    DomTreeNode* N,
    AAResults* AA,
    LoopInfo* LI,
    DominatorTree* DT,
    TargetLibraryInfo* TLI,
    TargetTransformInfo* TTI,
    Loop* CurLoop,
    MemorySSAUpdater& MSSAU,
    ICFLoopSafetyInfo* SafetyInfo,
    SinkAndHoistLICMFlags& Flags,
    OptimizationRemarkEmitter* ORE,
    Loop* OutermostLoop = nullptr);

Description

Walk the specified region of the CFG (defined by all blocks dominated by the specified block, and that are in the current loop) in reverse depth first order w.r.t the DominatorTree. This allows us to visit uses before definitions, allowing us to sink a loop body in one pass without iteration. Takes DomTreeNode, AAResults, LoopInfo, DominatorTree, TargetLibraryInfo, Loop, AliasSet information for all instructions of the loop and loop safety information as arguments. Diagnostics is emitted via ORE. It returns changed status. CurLoop is a loop to do sinking on. OutermostLoop is used only when this function is called by sinkRegionForLoopNest.

Return Value

True if any instructions were sunk.

Parameters

NameDescription
NDominator-tree node defining the region to walk.
AAAlias analysis results.
LILoop info for the function.
DTDominator tree for the function.
TLITarget library info.
TTITarget transform info.
CurLoopLoop whose body may be sunk.
MSSAUMemorySSA updater for the transform.
SafetyInfoLoop safety information for faulting ops.
FlagsCaps controlling MemorySSA query cost.
OREOptional remark emitter for diagnostics.
OutermostLoopOutermost loop when called from nest sinking.