diff options
| author | Craig Topper <craig.topper@gmail.com> | 2019-11-03 09:30:08 -0800 |
|---|---|---|
| committer | Craig Topper <craig.topper@gmail.com> | 2019-11-03 10:27:18 -0800 |
| commit | 910718bd038cdac1671069594a11f6b26bad9c8b (patch) | |
| tree | df30734dedb73193d28d366b37413da7463d68f0 /llvm | |
| parent | ce7d5a6bbee89f7bb9696e4894f5280a2d60ccf0 (diff) | |
| download | bcm5719-llvm-910718bd038cdac1671069594a11f6b26bad9c8b.tar.gz bcm5719-llvm-910718bd038cdac1671069594a11f6b26bad9c8b.zip | |
[opaque pointer types] Add element type argument to IRBuilder CreatePreserveStructAccessIndex and CreatePreserveArrayAccessIndex
Summary:
These were the only remaining users of the GetElementPtrInst::getGEPReturnType
method that gets the element type from the pointer type.
Remove that method since its now dead.
Reviewers: jyknight, t.p.northover, arsenm
Reviewed By: arsenm
Subscribers: wdng, arsenm, arphaman, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D69756
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/IR/IRBuilder.h | 14 | ||||
| -rw-r--r-- | llvm/include/llvm/IR/Instructions.h | 5 |
2 files changed, 8 insertions, 11 deletions
diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h index 05f311d8b72..f556db7893c 100644 --- a/llvm/include/llvm/IR/IRBuilder.h +++ b/llvm/include/llvm/IR/IRBuilder.h @@ -2521,8 +2521,9 @@ public: return V; } - Value *CreatePreserveArrayAccessIndex(Value *Base, unsigned Dimension, - unsigned LastIndex, MDNode *DbgInfo) { + Value *CreatePreserveArrayAccessIndex(Type *ElTy, Value *Base, + unsigned Dimension, unsigned LastIndex, + MDNode *DbgInfo) { assert(isa<PointerType>(Base->getType()) && "Invalid Base ptr type for preserve.array.access.index."); auto *BaseType = Base->getType(); @@ -2535,7 +2536,7 @@ public: IdxList.push_back(LastIndexV); Type *ResultType = - GetElementPtrInst::getGEPReturnType(Base, IdxList); + GetElementPtrInst::getGEPReturnType(ElTy, Base, IdxList); Module *M = BB->getParent()->getParent(); Function *FnPreserveArrayAccessIndex = Intrinsic::getDeclaration( @@ -2569,8 +2570,9 @@ public: return Fn; } - Value *CreatePreserveStructAccessIndex(Value *Base, unsigned Index, - unsigned FieldIndex, MDNode *DbgInfo) { + Value *CreatePreserveStructAccessIndex(Type *ElTy, Value *Base, + unsigned Index, unsigned FieldIndex, + MDNode *DbgInfo) { assert(isa<PointerType>(Base->getType()) && "Invalid Base ptr type for preserve.struct.access.index."); auto *BaseType = Base->getType(); @@ -2578,7 +2580,7 @@ public: Value *GEPIndex = getInt32(Index); Constant *Zero = ConstantInt::get(Type::getInt32Ty(Context), 0); Type *ResultType = - GetElementPtrInst::getGEPReturnType(Base, {Zero, GEPIndex}); + GetElementPtrInst::getGEPReturnType(ElTy, Base, {Zero, GEPIndex}); Module *M = BB->getParent()->getParent(); Function *FnPreserveStructAccessIndex = Intrinsic::getDeclaration( diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h index e9d3d2169be..74fd523111d 100644 --- a/llvm/include/llvm/IR/Instructions.h +++ b/llvm/include/llvm/IR/Instructions.h @@ -1039,11 +1039,6 @@ public: /// Returns the pointer type returned by the GEP /// instruction, which may be a vector of pointers. - static Type *getGEPReturnType(Value *Ptr, ArrayRef<Value *> IdxList) { - return getGEPReturnType( - cast<PointerType>(Ptr->getType()->getScalarType())->getElementType(), - Ptr, IdxList); - } static Type *getGEPReturnType(Type *ElTy, Value *Ptr, ArrayRef<Value *> IdxList) { Type *PtrTy = PointerType::get(checkGEPType(getIndexedType(ElTy, IdxList)), |

