This is an archive of the discontinued LLVM Phabricator instance.

[IR] Deprecate some old methods for getting typed pointer types
ClosedPublic

Authored by bjope on Jul 31 2023, 1:53 PM.

Details

Summary

The convenience methods that now are marked as deprecated are no
long used in-tree. The getInt8PtrTy helper is however still used in
many places, so it is not marked as deprecated to make it possible
to build LLVM with -Werror.

Diff Detail

Event Timeline

bjope created this revision.Jul 31 2023, 1:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 31 2023, 1:53 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
bjope requested review of this revision.Jul 31 2023, 1:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 31 2023, 1:53 PM
bjope updated this revision to Diff 548768.Aug 9 2023, 2:12 PM

Rebased, and cleaned up test_demangle.pass.cpp.

Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2023, 2:12 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
bjope added a reviewer: nikic.Aug 9 2023, 2:15 PM
bjope added a subscriber: nikic.

Any concerns about removing these helpers from Type? (@nikic I know you marked some other old API:s as deprecated rather than removing them directly, when dropping support for typed pointers. But I'm not sure if we need a deprecation period for this?)

nikic added a comment.Aug 9 2023, 2:33 PM

Any concerns about removing these helpers from Type? (@nikic I know you marked some other old API:s as deprecated rather than removing them directly, when dropping support for typed pointers. But I'm not sure if we need a deprecation period for this?)

For typed pointer APIs I would usually go for deprecation, because some of them were quite widely used. I guess if you didn't need to remove many uses in preparation for this patch, then dropping them directly is fine.

libcxxabi/test/test_demangle.pass.cpp
22532 ↗(On Diff #548768)

This test should not be modified. (It has no relation to LLVM; just uses our symbol names.)

bjope updated this revision to Diff 548957.Aug 10 2023, 3:48 AM

Revert the changed made to libcxxabi/test/test_demangle.pass.cpp
Mark unused functions as deprecated rather than removing them
(but also make the inline wrappers of getInt8Ptr).

bjope retitled this revision from [IR] Remove no longer used methods for getting typed pointer types to [IR] Deprecate some old methods for getting typed pointer types.Aug 10 2023, 3:49 AM
bjope edited the summary of this revision. (Show Details)
bjope removed a reviewer: Restricted Project.
This revision is now accepted and ready to land.Aug 10 2023, 3:56 AM
This revision was landed with ongoing or failed builds.Aug 10 2023, 6:08 AM
This revision was automatically updated to reflect the committed changes.
aeubanks added inline comments.
llvm/include/llvm/IR/Type.h
491

these are no longer static, that looks unintentional. probably nobody is using these anymore because they're not static, might as well just remove them or make them static again

bjope added inline comments.Aug 11 2023, 2:49 PM
llvm/include/llvm/IR/Type.h
491

Since all of them are doing the same thing I made these unused versions inline wrappers of getInt8PtrTy (which still is static).
And for the "To enforce that no two equal instances are created" part I think the important thing is that PointerType::get is static, or am I missing something?

@aeubanks : I'm not sure I understand how it is a problem that they aren't static?

(But I'm not sure we need to keep lots of deprecated methods. Not much difference really in getting a Wdeprecated warning or a failed compilation due to a missing function, at least not if building with Werror.)

aeubanks added inline comments.Aug 11 2023, 3:18 PM
llvm/include/llvm/IR/Type.h
491

It's a non-static member function now, not a static class method. Previously you'd use PointerType::getFloatPtrTy(), now you need an instance of a Type to call it.

bjope added inline comments.Aug 11 2023, 3:54 PM
llvm/include/llvm/IR/Type.h
491

Ah right, ofcourse. Now I got it!

Great catch. But then I think I'll just follow up with at patch that removes these functions (no one has complained so far anyway, and right now it is broken).