[llvm-commits] [llvm] r61047 - /llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
Chris Lattner
sabre at nondot.org
Mon Dec 15 13:20:32 PST 2008
Author: lattner
Date: Mon Dec 15 15:20:32 2008
New Revision: 61047
URL: http://llvm.org/viewvc/llvm-project?rev=61047&view=rev
Log:
Use stripPointerCasts.
Modified:
llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=61047&r1=61046&r2=61047&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Mon Dec 15 15:20:32 2008
@@ -1358,13 +1358,8 @@
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
More information about the llvm-commits
mailing list