diff options
author | Duncan Sands <baldrick@free.fr> | 2010-10-30 12:59:44 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2010-10-30 12:59:44 +0000 |
commit | ad6f541840015690ad1483821eb9d8e5f7e50442 (patch) | |
tree | 4742640225202bf68a05e255034fe1cc8ced3166 /lib | |
parent | 4aaf59d8ed5e565632314a1eeb7cf5a1fe1fdbe0 (diff) | |
download | external_llvm-ad6f541840015690ad1483821eb9d8e5f7e50442.zip external_llvm-ad6f541840015690ad1483821eb9d8e5f7e50442.tar.gz external_llvm-ad6f541840015690ad1483821eb9d8e5f7e50442.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117783 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/IPO/FunctionAttrs.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Transforms/IPO/FunctionAttrs.cpp b/lib/Transforms/IPO/FunctionAttrs.cpp index d4bce9e..39f48145 100644 --- a/lib/Transforms/IPO/FunctionAttrs.cpp +++ b/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; } |