Page MenuHomePhabricator

[WebAssembly][NFC] Update reftype and table tests to use opaque pointers
ClosedPublic

Authored by asb on May 27 2022, 6:17 AM.

Details

Summary

I'm currently doing some downstream experimentation on support for a broader set of GC types. Some of the options involve changes to the representation of externref and funcref at the IR level, and it seemed cleaner to convert to opaque pointers before further changing these tests. As this is something that needs to be done anyway, I thought I'd share the patch for upstream consideration.

externref-undef.ll is deleted as it's not really testing anything reftype specific.

Diff Detail

Event Timeline

asb created this revision.May 27 2022, 6:17 AM
asb requested review of this revision.May 27 2022, 6:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 27 2022, 6:17 AM
sbc100 added inline comments.May 27 2022, 6:51 AM
llvm/test/CodeGen/WebAssembly/externref-globalset.ll
3

So the old code used type opaque and the new code just uses ptr? But I take that the ptr is also somehow implicitly "opaque".. otherwise the PR description would not make sense? (Sorry i'm not familiar the opaque pointer stuff).

asb added inline comments.May 27 2022, 7:23 AM
llvm/test/CodeGen/WebAssembly/externref-globalset.ll
3

See here for an overview. Basically, pointers can still have an address space, but no longer have type information associated with them. Instead, you make use of a type argument for instructions that need it. As the page mentions, you can look at treatment of integer signedness as analogous - IR doesn't have signed and unsigned types, but has different operations that treat a value as signed or unsigned.

Clang now emits IR using opaque pointers by default, but the majority of .ll tests in llvm/test/ haven't been transitioned.

sbc100 added inline comments.May 27 2022, 7:39 AM
llvm/test/CodeGen/WebAssembly/externref-globalset.ll
3

I see.. the new ptr type is also opaque, so that the fact that you are removing the keyword opaque is not actually removing the opaqueness, since its now baked in.

asb added inline comments.May 27 2022, 7:44 AM
llvm/test/CodeGen/WebAssembly/externref-globalset.ll
3

Yep that's right, previously we had a typed pointer to an opaque struct type. Moving to ptr, all pointers are opaque.

Thanks for the change. LGTM.
I will rebase my further changes on top of this.

This revision was not accepted when it landed; it landed in state Needs Review.Jun 20 2022, 2:58 AM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.