[llvm] f164bc5 - [IRBuilder] Deprecate CreateGEP() without element type
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 17 14:03:13 PDT 2021
Author: Nikita Popov
Date: 2021-07-17T22:57:51+02:00
New Revision: f164bc52b61a34f8f95032e1e4fe68bd4eff995f
URL: https://github.com/llvm/llvm-project/commit/f164bc52b61a34f8f95032e1e4fe68bd4eff995f
DIFF: https://github.com/llvm/llvm-project/commit/f164bc52b61a34f8f95032e1e4fe68bd4eff995f.diff
LOG: [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.
Added:
Modified:
llvm/include/llvm/IR/IRBuilder.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h
index 8e76bb210537..8998ad0f94a9 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -1784,8 +1784,10 @@ class IRBuilderBase {
return Insert(new AtomicRMWInst(Op, Ptr, Val, *Align, Ordering, SSID));
}
- Value *CreateGEP(Value *Ptr, ArrayRef<Value *> IdxList,
- const Twine &Name = "") {
+ LLVM_ATTRIBUTE_DEPRECATED(
+ Value *CreateGEP(Value *Ptr, ArrayRef<Value *> 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 @@ class IRBuilderBase {
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<Constant>(Ptr))
if (auto *IC = dyn_cast<Constant>(Idx))
More information about the llvm-commits
mailing list