From 055fa09f2c1cd0af936c1214aa440fe6d245558d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 17 Jul 2021 21:29:05 +0200 Subject: [PATCH] [IRBuilder] Deprecate CreateGEP() without element type This API is incompatible with opaque pointers and deprecated in favor of the version that accepts an explicit element type. Also remove the separate overload for a single index, as this is already covered by the ArrayRef overload. --- include/llvm/IR/IRBuilder.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/include/llvm/IR/IRBuilder.h b/include/llvm/IR/IRBuilder.h index 8e76bb21053..8998ad0f94a 100644 --- a/include/llvm/IR/IRBuilder.h +++ b/include/llvm/IR/IRBuilder.h @@ -1784,8 +1784,10 @@ public: return Insert(new AtomicRMWInst(Op, Ptr, Val, *Align, Ordering, SSID)); } - Value *CreateGEP(Value *Ptr, ArrayRef IdxList, - const Twine &Name = "") { + LLVM_ATTRIBUTE_DEPRECATED( + Value *CreateGEP(Value *Ptr, ArrayRef IdxList, + const Twine &Name = ""), + "Use the version with explicit element type instead") { return CreateGEP(Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, IdxList, Name); } @@ -1828,11 +1830,6 @@ public: return Insert(GetElementPtrInst::CreateInBounds(Ty, Ptr, IdxList), Name); } - Value *CreateGEP(Value *Ptr, Value *Idx, const Twine &Name = "") { - return CreateGEP(Ptr->getType()->getScalarType()->getPointerElementType(), - Ptr, Idx, Name); - } - Value *CreateGEP(Type *Ty, Value *Ptr, Value *Idx, const Twine &Name = "") { if (auto *PC = dyn_cast(Ptr)) if (auto *IC = dyn_cast(Idx))