Changeset View
Changeset View
Standalone View
Standalone View
include/llvm/Analysis/Loads.h
Context not available. | |||||
bool isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom, | bool isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom, | ||||
unsigned Align); | unsigned Align); | ||||
/// DEF_MAX_INSTS_TO_SCAN - the default number of maximum instructions | |||||
/// to scan in the block, used by FindAvailableLoadedValue(). | |||||
/// FindAvailableLoadedValue() was introduced in r60148, to improve jump | |||||
/// threading in part by eliminating partially redundant loads. | |||||
/// At that point, the value of MaxInstsToScan was already set to '6' | |||||
/// without documented explanation. | |||||
/// FIXME: Ask r60148 author for details, and complete this documentation. | |||||
/// NOTE: As of now, every use of FindAvailableLoadedValue() uses this default | |||||
/// value of '6'. | |||||
#ifndef DEF_MAX_INSTS_TO_SCAN | |||||
#define DEF_MAX_INSTS_TO_SCAN 6 | |||||
#endif | |||||
nlewycky: The usual way to do this in LLVM is "cl::opt". Take a look at UnrollCount for an example. | |||||
Okay. Will do. lvoufo: Okay. Will do. | |||||
/// FindAvailableLoadedValue - Scan the ScanBB block backwards (starting at | /// FindAvailableLoadedValue - Scan the ScanBB block backwards (starting at | ||||
/// the instruction before ScanFrom) checking to see if we have the value at | /// the instruction before ScanFrom) checking to see if we have the value at | ||||
/// the memory address *Ptr locally available within a small number of | /// the memory address *Ptr locally available within a small number of | ||||
/// instructions. If the value is available, return it. | /// instructions. If the value is available, return it. | ||||
/// | /// | ||||
/// If not, return the iterator for the last validated instruction that the | /// If not, return the iterator for the last validated instruction that the | ||||
/// value would be live through. If we scanned the entire block and didn't | /// value would be live through. If we scanned the entire block and didn't | ||||
/// find something that invalidates *Ptr or provides it, ScanFrom would be | /// find something that invalidates *Ptr or provides it, ScanFrom would be | ||||
/// left at begin() and this returns null. ScanFrom could also be left | /// left at begin() and this returns null. ScanFrom could also be left | ||||
/// | /// | ||||
/// MaxInstsToScan specifies the maximum instructions to scan in the block. | /// MaxInstsToScan specifies the maximum instructions to scan in the block. | ||||
/// If it is set to 0, it will scan the whole block. You can also optionally | /// If it is set to 0, it will scan the whole block. You can also optionally | ||||
Context not available. | |||||
/// is found, it is left unmodified. | /// is found, it is left unmodified. | ||||
Value *FindAvailableLoadedValue(Value *Ptr, BasicBlock *ScanBB, | Value *FindAvailableLoadedValue(Value *Ptr, BasicBlock *ScanBB, | ||||
BasicBlock::iterator &ScanFrom, | BasicBlock::iterator &ScanFrom, | ||||
unsigned MaxInstsToScan = 6, | unsigned MaxInstsToScan = DEF_MAX_INSTS_TO_SCAN, | ||||
nlewyckyUnsubmitted Not Done ReplyInline ActionsUsing a cl::opt means you won't get to have a default here (unless you pick a sigil value like -1 to indicate "use the default"). However, I think every caller of this function passes in 6 today, so the default argument is dead anyways. However, I'm not sure why this should be a caller-controlled value at all. nlewycky: Using a cl::opt means you won't get to have a default here (unless you pick a sigil value like… | |||||
Not Done ReplyInline ActionsNot sure. DEF_MAX_INSTS_TO_SCAN was simply meant to highlight the very fact that the same value is reused everywhere anyway. lvoufo: Not sure. DEF_MAX_INSTS_TO_SCAN was simply meant to highlight the very fact that the same value… | |||||
AliasAnalysis *AA = nullptr, | AliasAnalysis *AA = nullptr, | ||||
AAMDNodes *AATags = nullptr); | AAMDNodes *AATags = nullptr); | ||||
Context not available. |
The usual way to do this in LLVM is "cl::opt". Take a look at UnrollCount for an example.