From 6312c53870897435b38881795460ad9f34bf9819 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 11 Feb 2021 22:33:18 +0100 Subject: [PATCH] [IRBuilder] Deprecate CreateLoad APIs with implicit type These APIs are not compatible with opaque pointers. Deprecate them to avoid the introduction of further uses. --- llvm/include/llvm/IR/IRBuilder.h | 37 +++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h index 10f2d72817e6..477d4815bc9d 100644 --- a/llvm/include/llvm/IR/IRBuilder.h +++ b/llvm/include/llvm/IR/IRBuilder.h @@ -1646,17 +1646,27 @@ public: } // Deprecated [opaque pointer types] - LoadInst *CreateLoad(Value *Ptr, const char *Name) { + LLVM_ATTRIBUTE_DEPRECATED(LoadInst *CreateLoad(Value *Ptr, + const char *Name), + "Use the version that explicitly specifies the " + "loaded type instead") { return CreateLoad(Ptr->getType()->getPointerElementType(), Ptr, Name); } // Deprecated [opaque pointer types] - LoadInst *CreateLoad(Value *Ptr, const Twine &Name = "") { + LLVM_ATTRIBUTE_DEPRECATED(LoadInst *CreateLoad(Value *Ptr, + const Twine &Name = ""), + "Use the version that explicitly specifies the " + "loaded type instead") { return CreateLoad(Ptr->getType()->getPointerElementType(), Ptr, Name); } // Deprecated [opaque pointer types] - LoadInst *CreateLoad(Value *Ptr, bool isVolatile, const Twine &Name = "") { + LLVM_ATTRIBUTE_DEPRECATED(LoadInst *CreateLoad(Value *Ptr, + bool isVolatile, + const Twine &Name = ""), + "Use the version that explicitly specifies the " + "loaded type instead") { return CreateLoad(Ptr->getType()->getPointerElementType(), Ptr, isVolatile, Name); } @@ -1685,19 +1695,30 @@ public: } // Deprecated [opaque pointer types] - LoadInst *CreateAlignedLoad(Value *Ptr, MaybeAlign Align, const char *Name) { + LLVM_ATTRIBUTE_DEPRECATED(LoadInst *CreateAlignedLoad(Value *Ptr, + MaybeAlign Align, + const char *Name), + "Use the version that explicitly specifies the " + "loaded type instead") { return CreateAlignedLoad(Ptr->getType()->getPointerElementType(), Ptr, Align, Name); } // Deprecated [opaque pointer types] - LoadInst *CreateAlignedLoad(Value *Ptr, MaybeAlign Align, - const Twine &Name = "") { + LLVM_ATTRIBUTE_DEPRECATED(LoadInst *CreateAlignedLoad(Value *Ptr, + MaybeAlign Align, + const Twine &Name = ""), + "Use the version that explicitly specifies the " + "loaded type instead") { return CreateAlignedLoad(Ptr->getType()->getPointerElementType(), Ptr, Align, Name); } // Deprecated [opaque pointer types] - LoadInst *CreateAlignedLoad(Value *Ptr, MaybeAlign Align, bool isVolatile, - const Twine &Name = "") { + LLVM_ATTRIBUTE_DEPRECATED(LoadInst *CreateAlignedLoad(Value *Ptr, + MaybeAlign Align, + bool isVolatile, + const Twine &Name = ""), + "Use the version that explicitly specifies the " + "loaded type instead") { return CreateAlignedLoad(Ptr->getType()->getPointerElementType(), Ptr, Align, isVolatile, Name); }