summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2010-10-30 12:59:44 +0000
committerDuncan Sands <baldrick@free.fr>2010-10-30 12:59:44 +0000
commitb8f3b14dfbc872a2803904cd14df55d159634df7 (patch)
tree097368443d0a156f5ad3f98303584753ed118be8 /llvm/lib/Transforms/IPO/FunctionAttrs.cpp
parenta71c9e2ebff32498f42830c7d3988554eea312e4 (diff)
downloadbcm5719-llvm-b8f3b14dfbc872a2803904cd14df55d159634df7.tar.gz
bcm5719-llvm-b8f3b14dfbc872a2803904cd14df55d159634df7.zip
If a function does a volatile load from a global constant, do not
consider it to be readonly. In fact, don't even consider it to be readonly if it does a volatile load from an AllocaInst either (it is debatable as to whether readonly would be correct or not in this case; play safe for the moment). This fixes PR8279. llvm-svn: 117783
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionAttrs.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/FunctionAttrs.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index d4bce9e48db..39f48145af1 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -188,12 +188,12 @@ bool FunctionAttrs::AddReadAttrs(const CallGraphSCC &SCC) {
continue;
}
} else if (LoadInst *LI = dyn_cast<LoadInst>(I)) {
- // Ignore loads from local memory.
- if (PointsToLocalMemory(LI->getPointerOperand()))
+ // Ignore non-volatile loads from local memory.
+ if (!LI->isVolatile() && PointsToLocalMemory(LI->getPointerOperand()))
continue;
} else if (StoreInst *SI = dyn_cast<StoreInst>(I)) {
- // Ignore stores to local memory.
- if (PointsToLocalMemory(SI->getPointerOperand()))
+ // Ignore non-volatile stores to local memory.
+ if (!SI->isVolatile() && PointsToLocalMemory(SI->getPointerOperand()))
continue;
}
OpenPOWER on IntegriCloud