llvm::canSinkOrHoistInst

Return true if I may legally be sunk or hoisted, ignoring faults.

Synopsis

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

bool
canSinkOrHoistInst(
    Instruction& I,
    AAResults* AA,
    DominatorTree* DT,
    Loop* CurLoop,
    MemorySSAUpdater& MSSAU,
    bool TargetExecutesOncePerLoop,
    SinkAndHoistLICMFlags& LICMFlags,
    OptimizationRemarkEmitter* ORE = nullptr);

Description

Returns true if is legal to hoist or sink this instruction disregarding the possible introduction of faults. Reasoning about potential faulting instructions is the responsibility of the caller since it is challenging to do efficiently from within this routine. TargetExecutesOncePerLoop is true only when it is guaranteed that the target executes at most once per execution of the loop body. This is used to assess the legality of duplicating atomic loads. Generally, this is true when moving out of loop and not true when moving into loops. If ORE is set use it to emit optimization remarks.

Return Value

True if I may legally be sunk or hoisted, ignoring faults.

Parameters

NameDescription
IInstruction considered for sinking or hoisting.
AAAlias analysis results.
DTDominator tree for the function.
CurLoopLoop containing I.
MSSAUMemorySSA updater used for memory dependence checks.
TargetExecutesOncePerLoopWhether the move target runs once per loop.
LICMFlagsCaps controlling MemorySSA query cost.
OREOptional remark emitter for diagnostics.