mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-22 10:16:43 +00:00
Use stripPointerCasts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61047 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
49b6d4ae9e
commit
344b41cfbd
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user