summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorLarisse Voufo <lvoufo@google.com>2015-09-18 19:14:35 +0000
committerLarisse Voufo <lvoufo@google.com>2015-09-18 19:14:35 +0000
commit532bf7153c8bba03f7d39449398130ee81b828cc (patch)
treeaa12f99a0e9e98b6f20395e151aa14313bbae56e /llvm/lib/Analysis
parentc4b28a8f741918b10b0a7211ccba288658e8e043 (diff)
downloadbcm5719-llvm-532bf7153c8bba03f7d39449398130ee81b828cc.tar.gz
bcm5719-llvm-532bf7153c8bba03f7d39449398130ee81b828cc.zip
Clean up: Refactoring the hardcoded value of 6 for FindAvailableLoadedValue()'s parameter MaxInstsToScan. (Complete version of r247497. See D12886)
llvm-svn: 248022
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/Lint.cpp5
-rw-r--r--llvm/lib/Analysis/Loads.cpp12
2 files changed, 15 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/Lint.cpp b/llvm/lib/Analysis/Lint.cpp
index 0f5599e8204..15acc783f07 100644
--- a/llvm/lib/Analysis/Lint.cpp
+++ b/llvm/lib/Analysis/Lint.cpp
@@ -829,8 +829,9 @@ Value *Lint::findValueImpl(Value *V, bool OffsetOk,
for (;;) {
if (!VisitedBlocks.insert(BB).second)
break;
- if (Value *U = FindAvailableLoadedValue(L->getPointerOperand(),
- BB, BBI, 6, AA))
+ if (Value *U =
+ FindAvailableLoadedValue(L->getPointerOperand(),
+ BB, BBI, DefMaxInstsToScan, AA))
return findValueImpl(U, OffsetOk, Visited);
if (BBI != BB->begin()) break;
BB = BB->getUniquePredecessor();
diff --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp
index 4d6d960f159..a544ac0c504 100644
--- a/llvm/lib/Analysis/Loads.cpp
+++ b/llvm/lib/Analysis/Loads.cpp
@@ -161,6 +161,18 @@ bool llvm::isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom,
return false;
}
+/// DefMaxInstsToScan - 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.
+cl::opt<unsigned>
+llvm::DefMaxInstsToScan("available-load-scan-limit", cl::init(6), cl::Hidden,
+ cl::desc("Use this to specify the default maximum number of instructions "
+ "to scan backward from a given instruction, when searching for "
+ "available loaded value"));
+
/// \brief Scan the ScanBB block backwards to see if we have the value at the
/// memory address *Ptr locally available within a small number of instructions.
///
OpenPOWER on IntegriCloud