diff options
author | Gabor Greif <ggreif@gmail.com> | 2010-07-12 14:13:15 +0000 |
---|---|---|
committer | Gabor Greif <ggreif@gmail.com> | 2010-07-12 14:13:15 +0000 |
commit | aaaaa02a93d3815d4cde97071ed354acc64ec6f6 (patch) | |
tree | 7d1ab4638e73831b363859397843f0b61ebadd69 | |
parent | b7df50006336831cdb2e1d68ff093d584f85365f (diff) |
cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108144 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/IPO/GlobalOpt.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 9b5511f3f2..735a1c47c3 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -1600,13 +1600,15 @@ static bool TryToShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) { GVElType->isFloatingPointTy() || GVElType->isPointerTy() || GVElType->isVectorTy()) return false; - + // Walk the use list of the global seeing if all the uses are load or store. // If there is anything else, bail out. - for (Value::use_iterator I = GV->use_begin(), E = GV->use_end(); I != E; ++I) - if (!isa<LoadInst>(I) && !isa<StoreInst>(I)) + for (Value::use_iterator I = GV->use_begin(), E = GV->use_end(); I != E; ++I){ + User *U = *I; + if (!isa<LoadInst>(U) && !isa<StoreInst>(U)) return false; - + } + DEBUG(dbgs() << " *** SHRINKING TO BOOL: " << *GV); // Create the new global, initializing it to false. |