[llvm-commits] [llvm] r41951 - /llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp
Tanya Lattner
tonic at nondot.org
Thu Sep 13 20:43:40 PDT 2007
Author: tbrethou
Date: Thu Sep 13 22:43:40 2007
New Revision: 41951
URL: http://llvm.org/viewvc/llvm-project?rev=41951&view=rev
Log:
Merge from mainline.
Modified:
llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp
Modified: llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp?rev=41951&r1=41950&r2=41951&view=diff
==============================================================================
--- llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp Thu Sep 13 22:43:40 2007
@@ -813,15 +813,14 @@
static bool ValueIsOnlyUsedLocallyOrStoredToOneGlobal(Instruction *V,
GlobalVariable *GV,
SmallPtrSet<PHINode*, 8> &PHIs) {
- for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI)
+ for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E; ++UI)
if (isa<LoadInst>(*UI) || isa<CmpInst>(*UI)) {
// Fine, ignore.
} else if (StoreInst *SI = dyn_cast<StoreInst>(*UI)) {
if (SI->getOperand(0) == V && SI->getOperand(1) != GV)
return false; // Storing the pointer itself... bad.
// Otherwise, storing through it, or storing into GV... fine.
- } else if (isa<GetElementPtrInst>(*UI) || isa<SelectInst>(*UI) ||
- isa<BitCastInst>(*UI)) {
+ } else if (isa<GetElementPtrInst>(*UI)) {
if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(cast<Instruction>(*UI),
GV, PHIs))
return false;
@@ -829,7 +828,8 @@
// PHIs are ok if all uses are ok. Don't infinitely recurse through PHI
// cycles.
if (PHIs.insert(PN))
- return ValueIsOnlyUsedLocallyOrStoredToOneGlobal(PN, GV, PHIs);
+ if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(PN, GV, PHIs))
+ return false;
} else {
return false;
}
More information about the llvm-commits
mailing list