summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorHaicheng Wu <haicheng@codeaurora.org>2017-12-19 13:42:58 +0000
committerHaicheng Wu <haicheng@codeaurora.org>2017-12-19 13:42:58 +0000
commitb3689cabda285b6ead0a6d92b20889e915d7fd8d (patch)
tree0a3dd1f1feb7160cc4e0fcd25b8e2f09289f3a0f /llvm/lib
parentfd5df639a3c464b5be20c5cd7746528b369fa740 (diff)
downloadbcm5719-llvm-b3689cabda285b6ead0a6d92b20889e915d7fd8d.tar.gz
bcm5719-llvm-b3689cabda285b6ead0a6d92b20889e915d7fd8d.zip
[InlineCost] Skip volatile loads when looking for repeated loads
This is a follow-up fix of r320814. A test case is also added. llvm-svn: 321075
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index fba96c8976a..9ba1e119494 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -363,6 +363,7 @@ void CallAnalyzer::accumulateSROACost(DenseMap<Value *, int>::iterator CostIt,
void CallAnalyzer::disableLoadElimination() {
if (EnableLoadElimination) {
Cost += LoadEliminationCost;
+ LoadEliminationCost = 0;
EnableLoadElimination = false;
}
}
@@ -1097,7 +1098,7 @@ bool CallAnalyzer::visitLoad(LoadInst &I) {
// by any stores or calls, this load is likely to be redundant and can be
// eliminated.
if (EnableLoadElimination &&
- !LoadAddrSet.insert(I.getPointerOperand()).second) {
+ !LoadAddrSet.insert(I.getPointerOperand()).second && I.isUnordered()) {
LoadEliminationCost += InlineConstants::InstrCost;
return true;
}
OpenPOWER on IntegriCloud