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 | 1c731fa86f493d08958a06a90e5853b3580f40a4 (patch) | |
tree | fa6b991031aea0822836c9406d998b911c0c5ad8 /llvm/lib/Transforms/IPO/GlobalOpt.cpp | |
parent | f0eb56802160eaa17397414e9c6dab1f634cddc0 (diff) | |
download | bcm5719-llvm-1c731fa86f493d08958a06a90e5853b3580f40a4.tar.gz bcm5719-llvm-1c731fa86f493d08958a06a90e5853b3580f40a4.zip |
Use stripPointerCasts.
llvm-svn: 61047
Diffstat (limited to 'llvm/lib/Transforms/IPO/GlobalOpt.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/GlobalOpt.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index 62e671fb611..41ff3f37d56 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/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 |