llvm::canHoistLoad

Return true if load LI may legally be hoisted out of CurLoop.

Synopsis

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

bool
canHoistLoad(
    LoadInst& LI,
    AAResults* AA,
    DominatorTree* DT,
    Loop* CurLoop,
    MemorySSA& MSSA,
    bool TargetExecutesOncePerLoop,
    SinkAndHoistLICMFlags& LICMFlags,
    OptimizationRemarkEmitter* ORE = nullptr);

Description

This is the load-specific subset of canSinkOrHoistInst it rejects volatile or ordered loads, allows constant-memory / invariant.load / invariant.start-dominated loads unconditionally, and otherwise queries MSSA for an in-loop clobber. TargetExecutesOncePerLoop has the same meaning as in canSinkOrHoistInst (set to true when hoisting to the preheader).

Return Value

True if LI may legally be hoisted out of CurLoop.

Parameters

NameDescription
LILoad considered for hoisting.
AAAlias analysis results.
DTDominator tree for the function.
CurLoopLoop containing LI.
MSSAMemorySSA used to find in-loop clobbers.
TargetExecutesOncePerLoopWhether the hoist target runs once per loop.
LICMFlagsCaps controlling MemorySSA query cost.
OREOptional remark emitter for diagnostics.