This is an archive of the discontinued LLVM Phabricator instance.

[mlir][LLVM] Don't make `LLVM_IntPtrBase` a `BuildableType` to allow the use of opaque pointers
ClosedPublic

Authored by zero9178 on Feb 21 2023, 6:18 AM.

Details

Summary

Making the constraint a buildable type makes them incompatible with opaque pointers, at least while we still support typed pointers, since Ops making use of the constraint will then automatically create a typed pointer on parse.

This patch therefore fixes that issue by removing the BuildableType mixin. This has a bit of a cascading effect however, as all users of the constraint now need operands of that type to be added to the assembly format, hence a lot of adjustments to the syntax of a lot of (mostly intrinsic) ops.

Few things of note: The syntax as is, is only required while we're supporting both typed and opaque pointers. Once we drop support for typed pointers, we can make it a BuildableType again. As a drive by I also fixed the address space not being verified in the constraint. Finally, I added some roundtripping tests, most importantly for ops with type($specific_operand) occurences. These are printed incorrectly with typed pointers if not wrapped within a qualified.

Diff Detail

Event Timeline

zero9178 created this revision.Feb 21 2023, 6:18 AM
Herald added a project: Restricted Project. · View Herald Transcript
zero9178 requested review of this revision.Feb 21 2023, 6:18 AM
ftynse accepted this revision.Feb 21 2023, 10:16 AM
ftynse added inline comments.
mlir/test/Target/LLVMIR/Import/intrinsic.ll
434

Should the trailing type be updated rather than dropped?

This revision is now accepted and ready to land.Feb 21 2023, 10:16 AM
zero9178 updated this revision to Diff 499250.Feb 21 2023, 11:38 AM

Address review comments

This revision was landed with ongoing or failed builds.Feb 21 2023, 11:46 AM
This revision was automatically updated to reflect the committed changes.