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 | a75ed761a9a1f76a37d1caf120367a12022aa5a0 (patch) | |
tree | 917280f323cdbbf26d1cbbcbf2957144b8b0de6f /llvm/lib/Transforms/IPO/GlobalOpt.cpp | |
parent | 15445db11b77d9c20984b438b3237c9566eda309 (diff) | |
download | bcm5719-llvm-a75ed761a9a1f76a37d1caf120367a12022aa5a0.tar.gz bcm5719-llvm-a75ed761a9a1f76a37d1caf120367a12022aa5a0.zip |
cache result of operator*
llvm-svn: 108144
Diffstat (limited to 'llvm/lib/Transforms/IPO/GlobalOpt.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/GlobalOpt.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index 9b5511f3f21..735a1c47c39 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/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. |