[opaque pointer type] Change GetElementPtrInst::getIndexedType to take the pointee type

This pushes the use of PointerType::getElementType up into several
callers - I'll essentially just have to keep pushing that up the stack
until I can eliminate every call to it...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233604 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie
2015-03-30 21:41:43 +00:00
parent a55ae077e4
commit 25e3d2d6d3
11 changed files with 44 additions and 32 deletions

View File

@ -674,8 +674,9 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
for (ScalarizeTable::iterator SI = ArgIndices.begin(),
E = ArgIndices.end(); SI != E; ++SI) {
// not allowed to dereference ->begin() if size() is 0
Params.push_back(
GetElementPtrInst::getIndexedType(I->getType(), SI->second));
Params.push_back(GetElementPtrInst::getIndexedType(
cast<PointerType>(I->getType()->getScalarType())->getElementType(),
SI->second));
assert(Params.back());
}

View File

@ -611,8 +611,10 @@ static bool canReplaceGEPIdxWithZero(InstCombiner &IC, GetElementPtrInst *GEPI,
return false;
SmallVector<Value *, 4> Ops(GEPI->idx_begin(), GEPI->idx_begin() + Idx);
Type *AllocTy =
GetElementPtrInst::getIndexedType(GEPI->getOperand(0)->getType(), Ops);
Type *AllocTy = GetElementPtrInst::getIndexedType(
cast<PointerType>(GEPI->getOperand(0)->getType()->getScalarType())
->getElementType(),
Ops);
if (!AllocTy || !AllocTy->isSized())
return false;
const DataLayout &DL = IC.getDataLayout();