Skip to content

[IR] Deprecate PointerType::get/getUnqual pointee type overload #134517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

junlarsen
Copy link
Member

@junlarsen junlarsen commented Apr 6, 2025

Deprecates the methods and schedules them for removal in the future as
the overloads taking LLVMContext are preferred, as the pointee type
has no meaning in opaque pointers.

From what my clangd can tell, there are no usages left in the monorepo

Part of #123569

Deprecates the methods and schedules them for removal in the future as
the overloads taking LLVMContext are preferred, as the pointee type
has no meaning in opaque pointers.

Part of #123569
@llvmbot llvmbot added the llvm:ir label Apr 6, 2025
Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@llvmbot
Copy link
Member

llvmbot commented Apr 6, 2025

@llvm/pr-subscribers-llvm-ir

Author: Mats Jun Larsen (junlarsen)

Changes

Deprecates the methods and schedules them for removal in the future as
the overloads taking LLVMContext are preferred, as the pointee type
has no meaning in opaque pointers.

Part of #123569


Full diff: https://github.com/llvm/llvm-project/pull/134517.diff

1 Files Affected:

  • (modified) llvm/include/llvm/IR/DerivedTypes.h (+6)
diff --git a/llvm/include/llvm/IR/DerivedTypes.h b/llvm/include/llvm/IR/DerivedTypes.h
index 60606d34c32c3..cc6230287bfe4 100644
--- a/llvm/include/llvm/IR/DerivedTypes.h
+++ b/llvm/include/llvm/IR/DerivedTypes.h
@@ -685,6 +685,9 @@ class PointerType : public Type {
 
   /// This constructs a pointer to an object of the specified type in a numbered
   /// address space.
+  LLVM_DEPRECATED("PointerType::get with pointee type is pending removal. Use "
+                  "Context overload.",
+                  "PointerType::get(LLVMContext, AS)")
   static PointerType *get(Type *ElementType, unsigned AddressSpace);
   /// This constructs an opaque pointer to an object in a numbered address
   /// space.
@@ -692,6 +695,9 @@ class PointerType : public Type {
 
   /// This constructs a pointer to an object of the specified type in the
   /// default address space (address space zero).
+  LLVM_DEPRECATED("PointerType::getUnqual with pointee type is pending "
+                  "removal. Use Context overload.",
+                  "PointerType::getUnqual(LLVMCOntext)")
   static PointerType *getUnqual(Type *ElementType) {
     return PointerType::get(ElementType, 0);
   }

@@ -685,13 +685,19 @@ class PointerType : public Type {

/// This constructs a pointer to an object of the specified type in a numbered
/// address space.
LLVM_DEPRECATED("PointerType::get with pointee type is pending removal. Use "
"Context overload.",
"PointerType::get(LLVMContext, AS)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use [[deprecated]] instead. Only use LLVM_DEPRECATED if you can actually provide a working fixit, which you can't do here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up! Taken care of in b3c03d6

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@junlarsen junlarsen merged commit 146ad71 into main Apr 6, 2025
11 checks passed
@junlarsen junlarsen deleted the users/junlarsen/_ir_deprecate_pointertype_get_getunqual_pointee_type_overload branch April 6, 2025 23:30
@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 6, 2025

LLVM Buildbot has detected a new failure on builder clangd-ubuntu-tsan running on clangd-ubuntu-clang while building llvm at step 5 "build-clangd-clangd-index-server-clangd-indexer".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/134/builds/16395

Here is the relevant piece of the build log for the reference
Step 5 (build-clangd-clangd-index-server-clangd-indexer) failure: build (failure)
0.006 [3237/18/1] Building CXX object lib/Demangle/CMakeFiles/LLVMDemangle.dir/MicrosoftDemangleNodes.cpp.o
FAILED: lib/Demangle/CMakeFiles/LLVMDemangle.dir/MicrosoftDemangleNodes.cpp.o 
ccache /usr/bin/clang++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/build/lib/Demangle -I/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/llvm/lib/Demangle -I/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/build/include -I/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fno-omit-frame-pointer -gline-tables-only -fsanitize=thread -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT lib/Demangle/CMakeFiles/LLVMDemangle.dir/MicrosoftDemangleNodes.cpp.o -MF lib/Demangle/CMakeFiles/LLVMDemangle.dir/MicrosoftDemangleNodes.cpp.o.d -o lib/Demangle/CMakeFiles/LLVMDemangle.dir/MicrosoftDemangleNodes.cpp.o -c /vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp
ccache: error: /vol/ccache/ccache.conf: No such file or directory
0.009 [3237/17/2] Creating /vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/build/NATIVE...
1.058 [3237/16/3] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/AArch64BuildAttributes.cpp.o
1.187 [3237/15/4] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/IntEqClasses.cpp.o
1.253 [3237/14/5] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/InstructionCost.cpp.o
1.254 [3237/13/6] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/ARMBuildAttributes.cpp.o
1.387 [3237/12/7] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/IntervalMap.cpp.o
1.391 [3237/11/8] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/AArch64AttributeParser.cpp.o
1.498 [3237/10/9] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/APSInt.cpp.o
1.545 [3237/9/10] Building CXX object lib/Demangle/CMakeFiles/LLVMDemangle.dir/RustDemangle.cpp.o
1.619 [3237/8/11] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/InitLLVM.cpp.o
2.068 [3237/7/12] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/APFixedPoint.cpp.o
2.376 [3237/6/13] Building CXX object lib/Demangle/CMakeFiles/LLVMDemangle.dir/MicrosoftDemangle.cpp.o
2.567 [3237/5/14] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/AMDGPUMetadata.cpp.o
2.680 [3237/4/15] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/ARMAttributeParser.cpp.o
4.087 [3237/3/16] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/APInt.cpp.o
4.371 [3237/2/17] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/APFloat.cpp.o
5.471 [3237/1/18] Building CXX object lib/Demangle/CMakeFiles/LLVMDemangle.dir/ItaniumDemangle.cpp.o
ninja: build stopped: subcommand failed.

static PointerType *get(Type *ElementType, unsigned AddressSpace);
/// This constructs an opaque pointer to an object in a numbered address
/// space.
static PointerType *get(LLVMContext &C, unsigned AddressSpace);

/// This constructs a pointer to an object of the specified type in the
/// default address space (address space zero).
[[deprecated("PointerType::getUnqual with pointee type is pending removal. "
"Use Context overload.")]]
static PointerType *getUnqual(Type *ElementType) {
return PointerType::get(ElementType, 0);
Copy link
Collaborator

@RKSimon RKSimon Apr 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@junlarsen MSVC is warning because this is calling the now deprecated llvm.PointerType.get() variant - would it be possible for you to update this to call the LLVMContext variant directly to silence the warning and allow us to re-enable Werror builds please?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll do that.

junlarsen added a commit that referenced this pull request Apr 7, 2025
junlarsen added a commit that referenced this pull request Apr 7, 2025
Should keep MSVC quiet as noticed by @RKSimon in #134517.

Assertions have been copied over from PointerType::get in order to not
silently change invariants with this call.
kuhar added a commit to iree-org/iree that referenced this pull request Apr 8, 2025
The major changes come from the following PRs:
* llvm/llvm-project#131226
* llvm/llvm-project#134264
* llvm/llvm-project#134169
* llvm/llvm-project#134517

---------

Signed-off-by: MaheshRavishankar <[email protected]>
Signed-off-by: Jakub Kuderski <[email protected]>
Co-authored-by: MaheshRavishankar <[email protected]>
qiaojbao pushed a commit to GPUOpen-Drivers/llvm-project that referenced this pull request Apr 29, 2025
Local branch origin/amd-gfx b969d46 Merged main:94821ce45fe9 into origin/amd-gfx:6bc8f8a713b9
Remote branch main 146ad71 [IR] Deprecate PointerType::get/getUnqual pointee type overload (llvm#134517)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants