aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/IPA/GlobalsModRef.cpp
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2010-07-09 16:22:36 +0000
committerGabor Greif <ggreif@gmail.com>2010-07-09 16:22:36 +0000
commit27013507b59f50440ed3ddf001e5e0649bb46eee (patch)
tree55c350430a2356bb99f00f0b580efcaafb87069a /lib/Analysis/IPA/GlobalsModRef.cpp
parent833b2a7cc1cc7a801be96c62cdd62e539b2ce52c (diff)
downloadexternal_llvm-27013507b59f50440ed3ddf001e5e0649bb46eee.zip
external_llvm-27013507b59f50440ed3ddf001e5e0649bb46eee.tar.gz
external_llvm-27013507b59f50440ed3ddf001e5e0649bb46eee.tar.bz2
cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107982 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/IPA/GlobalsModRef.cpp')
-rw-r--r--lib/Analysis/IPA/GlobalsModRef.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/IPA/GlobalsModRef.cpp
index 7ff8a58..f13deea 100644
--- a/lib/Analysis/IPA/GlobalsModRef.cpp
+++ b/lib/Analysis/IPA/GlobalsModRef.cpp
@@ -294,7 +294,8 @@ bool GlobalsModRef::AnalyzeIndirectGlobalMemory(GlobalValue *GV) {
// Walk the user list of the global. If we find anything other than a direct
// load or store, bail out.
for (Value::use_iterator I = GV->use_begin(), E = GV->use_end(); I != E; ++I){
- if (LoadInst *LI = dyn_cast<LoadInst>(*I)) {
+ User *U = *I;
+ if (LoadInst *LI = dyn_cast<LoadInst>(U)) {
// The pointer loaded from the global can only be used in simple ways:
// we allow addressing of it and loading storing to it. We do *not* allow
// storing the loaded pointer somewhere else or passing to a function.
@@ -302,7 +303,7 @@ bool GlobalsModRef::AnalyzeIndirectGlobalMemory(GlobalValue *GV) {
if (AnalyzeUsesOfPointer(LI, ReadersWriters, ReadersWriters))
return false; // Loaded pointer escapes.
// TODO: Could try some IP mod/ref of the loaded pointer.
- } else if (StoreInst *SI = dyn_cast<StoreInst>(*I)) {
+ } else if (StoreInst *SI = dyn_cast<StoreInst>(U)) {
// Storing the global itself.
if (SI->getOperand(0) == GV) return false;