1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

Revert "Clean up: Refactoring the hardcoded value of 6 for FindAvailableLoadedValue()'s parameter MaxInstsToScan." for preliminary community discussion (See. D12886)

llvm-svn: 247716
This commit is contained in:
Larisse Voufo 2015-09-15 19:14:05 +00:00
parent e2c9d29cd0
commit 33950c83d4
4 changed files with 11 additions and 27 deletions

View File

@ -29,19 +29,6 @@ class MDNode;
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
/// 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
@ -61,7 +48,7 @@ bool isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom,
/// 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 = DEF_MAX_INSTS_TO_SCAN, unsigned MaxInstsToScan = 6,
AliasAnalysis *AA = nullptr, AliasAnalysis *AA = nullptr,
AAMDNodes *AATags = nullptr); AAMDNodes *AATags = nullptr);

View File

@ -829,9 +829,8 @@ Value *Lint::findValueImpl(Value *V, bool OffsetOk,
for (;;) { for (;;) {
if (!VisitedBlocks.insert(BB).second) if (!VisitedBlocks.insert(BB).second)
break; break;
if (Value *U = if (Value *U = FindAvailableLoadedValue(L->getPointerOperand(),
FindAvailableLoadedValue(L->getPointerOperand(), BB, BBI, 6, AA))
BB, BBI, DEF_MAX_INSTS_TO_SCAN, AA))
return findValueImpl(U, OffsetOk, Visited); return findValueImpl(U, OffsetOk, Visited);
if (BBI != BB->begin()) break; if (BBI != BB->begin()) break;
BB = BB->getUniquePredecessor(); BB = BB->getUniquePredecessor();

View File

@ -750,9 +750,8 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
// separated by a few arithmetic operations. // separated by a few arithmetic operations.
BasicBlock::iterator BBI = &LI; BasicBlock::iterator BBI = &LI;
AAMDNodes AATags; AAMDNodes AATags;
if (Value *AvailableVal = if (Value *AvailableVal = FindAvailableLoadedValue(Op, LI.getParent(), BBI,
FindAvailableLoadedValue(Op, LI.getParent(), BBI, 6, AA, &AATags)) {
DEF_MAX_INSTS_TO_SCAN, AA, &AATags)) {
if (LoadInst *NLI = dyn_cast<LoadInst>(AvailableVal)) { if (LoadInst *NLI = dyn_cast<LoadInst>(AvailableVal)) {
unsigned KnownIDs[] = { unsigned KnownIDs[] = {
LLVMContext::MD_tbaa, LLVMContext::MD_tbaa,

View File

@ -877,7 +877,7 @@ bool JumpThreading::SimplifyPartiallyRedundantLoad(LoadInst *LI) {
BasicBlock::iterator BBIt = LI; BasicBlock::iterator BBIt = LI;
if (Value *AvailableVal = if (Value *AvailableVal =
FindAvailableLoadedValue(LoadedPtr, LoadBB, BBIt)) { FindAvailableLoadedValue(LoadedPtr, LoadBB, BBIt, 6)) {
// If the value if the load is locally available within the block, just use // If the value if the load is locally available within the block, just use
// it. This frequently occurs for reg2mem'd allocas. // it. This frequently occurs for reg2mem'd allocas.
//cerr << "LOAD ELIMINATED:\n" << *BBIt << *LI << "\n"; //cerr << "LOAD ELIMINATED:\n" << *BBIt << *LI << "\n";
@ -922,8 +922,7 @@ bool JumpThreading::SimplifyPartiallyRedundantLoad(LoadInst *LI) {
// Scan the predecessor to see if the value is available in the pred. // Scan the predecessor to see if the value is available in the pred.
BBIt = PredBB->end(); BBIt = PredBB->end();
AAMDNodes ThisAATags; AAMDNodes ThisAATags;
Value *PredAvailable = FindAvailableLoadedValue(LoadedPtr, PredBB, BBIt, Value *PredAvailable = FindAvailableLoadedValue(LoadedPtr, PredBB, BBIt, 6,
DEF_MAX_INSTS_TO_SCAN,
nullptr, &ThisAATags); nullptr, &ThisAATags);
if (!PredAvailable) { if (!PredAvailable) {
OneUnavailablePred = PredBB; OneUnavailablePred = PredBB;