This is an archive of the discontinued LLVM Phabricator instance.

OpaquePtr: Support i32** with --force-opaque-pointers
ClosedPublic

Authored by dexonsmith on Jun 29 2021, 12:57 PM.

Details

Reviewers
nikic
dblaikie
Group Reviewers
Restricted Project
Commits
rGac2bec5addd2: OpaquePtr: Support i32** with --force-opaque-pointers
Summary

4506f614cb6983a16d117cf77a968608e66d7a5c fixed parsing of textual IR to
reject ptr*, but broke the auto-conversion of i32** to ptr with
--force-opaque-pointers.

Get that working again by refactoring LLParser::parseType to only send
ptr-spelled pointers into the type suffix logic when it's the return
of a function type. This also rejects ptr addrspace(3) addrspace(2),
which 1e6303e60ca5af4fbe7ca728572fd65666a98271 invadvertently started
accepting. Just the default top-level error message for the
double-addrspace since I had trouble thinking of something nice; open to
ideas, but it's fine as is (it doesn't look valid the way that ptr*
does).

Diff Detail

Event Timeline

dexonsmith created this revision.Jun 29 2021, 12:57 PM
dexonsmith requested review of this revision.Jun 29 2021, 12:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 29 2021, 12:57 PM
dexonsmith added inline comments.Jun 29 2021, 1:00 PM
llvm/lib/AsmParser/LLParser.cpp
2630–2645

Actually, maybe this is all wrong. ptr addrspace(1) addrspace(2) isn't valid. This would have been rejected originally, but was loosened at the same time that ptr * slipped through.

I'll undo the addrspace logic shuffle, and update this patch to fix that bug too.

dblaikie accepted this revision.Jun 29 2021, 1:08 PM
dblaikie added a subscriber: dblaikie.

Looks good to me!

This revision is now accepted and ready to land.Jun 29 2021, 1:08 PM
dexonsmith requested review of this revision.Jun 29 2021, 1:38 PM
dexonsmith updated this revision to Diff 355351.
dexonsmith edited the summary of this revision. (Show Details)

Looks good to me!

Thanks for the review! After noticing the addrspace problem I rewrote the patch and added more tests; PTAL when you get a chance.

nikic accepted this revision.Jun 29 2021, 1:43 PM

LGTM, thanks!

This revision is now accepted and ready to land.Jun 29 2021, 1:43 PM
This revision was landed with ongoing or failed builds.Jun 29 2021, 2:11 PM
This revision was automatically updated to reflect the committed changes.