ΒΆllvm::Value* FindAvailableLoadedValue(
llvm::LoadInst* Load,
llvm::BasicBlock* ScanBB,
BasicBlock::iterator& ScanFrom,
unsigned int MaxInstsToScan =
DefMaxInstsToScan,
llvm::AliasAnalysis* AA = nullptr,
bool* IsLoadCSE = nullptr,
unsigned int* NumScanedInst = nullptr)
llvm::Value* FindAvailableLoadedValue(
llvm::LoadInst* Load,
llvm::BasicBlock* ScanBB,
BasicBlock::iterator& ScanFrom,
unsigned int MaxInstsToScan =
DefMaxInstsToScan,
llvm::AliasAnalysis* AA = nullptr,
bool* IsLoadCSE = nullptr,
unsigned int* NumScanedInst = nullptr)
Description
Scan backwards to see if we have the value of the given load available locally within a small number of instructions. You can use this function to scan across multiple blocks: after you call this function, if ScanFrom points at the beginning of the block, it's safe to continue scanning the predecessors. Note that performing load CSE requires special care to make sure the metadata is set appropriately. In particular, aliasing metadata needs to be merged. (This doesn't matter for store-to-load forwarding because the only relevant load gets deleted.)
Declared at: llvm/include/llvm/Analysis/Loads.h:119
Parameters
- llvm::LoadInst* Load
- The load we want to replace.
- llvm::BasicBlock* ScanBB
- The basic block to scan.
- BasicBlock::iterator& ScanFrom
- The location to start scanning from. When this function returns, it points at the last instruction scanned.
- unsigned int MaxInstsToScan = DefMaxInstsToScan
- The maximum number of instructions to scan. If this is zero, the whole block will be scanned.
- llvm::AliasAnalysis* AA = nullptr
- Optional pointer to alias analysis, to make the scan more precise.
- bool* IsLoadCSE = nullptr
- Whether the returned value is a load from the same location in memory, as opposed to the value operand of a store.
- unsigned int* NumScanedInst = nullptr
Returns
The found value, or nullptr if no value is found.