From 19eb03106d6042a404f4943f3e9efc74da6865f6 Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Tue, 19 Jan 2016 17:28:00 +0000 Subject: [opaque pointer types] [NFC] GEP: replace get(Pointer)ElementType uses with get{Source,Result}ElementType. Summary: GEPOperator: provide getResultElementType alongside getSourceElementType. This is made possible by adding a result element type field to GetElementPtrConstantExpr, which GetElementPtrInst already has. GEP: replace get(Pointer)ElementType uses with get{Source,Result}ElementType. Reviewers: mjacob, dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16275 llvm-svn: 258145 --- llvm/lib/IR/ConstantsContext.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'llvm/lib/IR/ConstantsContext.h') diff --git a/llvm/lib/IR/ConstantsContext.h b/llvm/lib/IR/ConstantsContext.h index 13fcbd2ece1..a03279554c5 100644 --- a/llvm/lib/IR/ConstantsContext.h +++ b/llvm/lib/IR/ConstantsContext.h @@ -225,19 +225,12 @@ public: /// used behind the scenes to implement getelementpr constant exprs. class GetElementPtrConstantExpr : public ConstantExpr { Type *SrcElementTy; + Type *ResElementTy; void anchor() override; GetElementPtrConstantExpr(Type *SrcElementTy, Constant *C, ArrayRef IdxList, Type *DestTy); public: - static GetElementPtrConstantExpr *Create(Constant *C, - ArrayRef IdxList, - Type *DestTy, - unsigned Flags) { - return Create( - cast(C->getType()->getScalarType())->getElementType(), C, - IdxList, DestTy, Flags); - } static GetElementPtrConstantExpr *Create(Type *SrcElementTy, Constant *C, ArrayRef IdxList, Type *DestTy, unsigned Flags) { @@ -247,6 +240,7 @@ public: return Result; } Type *getSourceElementType() const; + Type *getResultElementType() const; /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); -- cgit v1.2.3