diff options
author | Chris Lattner <sabre@nondot.org> | 2008-12-15 21:20:32 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-12-15 21:20:32 +0000 |
commit | 344b41cfbd30980a2194c56db382b0537d087ea9 (patch) | |
tree | 6b56adfea6400eed69304880202bf788cd88c2c2 /lib/Transforms | |
parent | 49b6d4ae9e3132525657880c45619f83e5c89c8f (diff) |
Use stripPointerCasts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61047 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/GlobalOpt.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 62e671fb61..41ff3f37d5 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -1358,13 +1358,8 @@ static bool TryToOptimizeStoreOfMallocToGlobal(GlobalVariable *GV, static bool OptimizeOnceStoredGlobal(GlobalVariable *GV, Value *StoredOnceVal, Module::global_iterator &GVI, TargetData &TD) { - if (BitCastInst *CI = dyn_cast<BitCastInst>(StoredOnceVal)) - StoredOnceVal = CI->getOperand(0); - else if (GetElementPtrInst *GEPI =dyn_cast<GetElementPtrInst>(StoredOnceVal)){ - // "getelementptr Ptr, 0, 0, 0" is really just a cast. - if (GEPI->hasAllZeroIndices()) - StoredOnceVal = GEPI->getOperand(0); - } + // Ignore no-op GEPs and bitcasts. + StoredOnceVal = StoredOnceVal->stripPointerCasts(); // If we are dealing with a pointer global that is initialized to null and // only has one (non-null) value stored into it, then we can optimize any |