diff options
author | Tanya Lattner <tonic@nondot.org> | 2007-09-14 03:43:40 +0000 |
---|---|---|
committer | Tanya Lattner <tonic@nondot.org> | 2007-09-14 03:43:40 +0000 |
commit | 1a66c09a6f52663c9094ab3dae307f459af37a8c (patch) | |
tree | 9c06a91ccee0efc2f35ce504ce3315bf70109fc0 /lib/Transforms/IPO/GlobalOpt.cpp | |
parent | 84dd6546e6bbdefb89d04acf2538616a975c3f8f (diff) |
Merge from mainline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_21@41951 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/GlobalOpt.cpp')
-rw-r--r-- | lib/Transforms/IPO/GlobalOpt.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 8761e2265e..5d8f969f33 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -813,15 +813,14 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV, 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 @@ static bool ValueIsOnlyUsedLocallyOrStoredToOneGlobal(Instruction *V, // 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; } |