This is an archive of the discontinued LLVM Phabricator instance.

[DirectX] Support opaque ptr for ValueAsMetadata in DXILBitcodeWriter
ClosedPublic

Authored by python3kgae on Jun 13 2022, 5:16 PM.

Details

Summary

When writeValueAsMetadata for GlobalVariable and Function, write TypedPointerType for ValueType and FunctionType.

Diff Detail

Event Timeline

python3kgae created this revision.Jun 13 2022, 5:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 13 2022, 5:16 PM
python3kgae requested review of this revision.Jun 13 2022, 5:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 13 2022, 5:16 PM
arsenm added inline comments.Jun 13 2022, 5:20 PM
llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp
1362

This should also query the address space

Save addresspace for Function.

python3kgae marked an inline comment as done.Jun 13 2022, 7:28 PM
python3kgae added inline comments.
llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp
1362

Fixed.
Never know Function can have address space before.

bogner accepted this revision.Jun 21 2022, 10:19 AM

LGTM with a comment about the test

llvm/test/tools/dxil-dis/opaque-value_as_metadata.ll
29

Is it worth trying to anchor this to the dx metadata (ie, capture the "!8" from "!dx.entryPoints" rather than using the regex...)? I think that'd make what the test is doing a little clearer, but I guess this will be reliable enough as is based on looking for @CBV/@main, so it's probably not a big deal if that's more complicated than it's worth.

Aside, the regex should be {{[0-9]+}} just in cast this ends up being !10

This revision is now accepted and ready to land.Jun 21 2022, 10:19 AM
python3kgae marked an inline comment as done.

Update regex to cover more cases.

python3kgae marked an inline comment as done.Jun 22 2022, 6:26 AM
python3kgae added inline comments.
llvm/test/tools/dxil-dis/opaque-value_as_metadata.ll
29

Thanks for review.
The !8 will change, that's why I use regex here.
Changed to {{[0-9]+}}

This revision was landed with ongoing or failed builds.Jun 22 2022, 9:10 AM
This revision was automatically updated to reflect the committed changes.
python3kgae marked an inline comment as done.