This is an archive of the discontinued LLVM Phabricator instance.

[DirectX backend] remove string function attribute and unused module flags
Needs ReviewPublic

Authored by python3kgae on Feb 12 2023, 12:16 PM.

Details

Summary

Remove string function attribute and unused module flags to match DXIL which is based on llvm 3.7.

Also move DXILPrepare pass after DXILTranslateMetadata pass because things like "hlsl.numthreads" will be removed by DXILPrepare pass now.

Diff Detail

Event Timeline

python3kgae created this revision.Feb 12 2023, 12:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 12 2023, 12:16 PM
python3kgae requested review of this revision.Feb 12 2023, 12:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 12 2023, 12:16 PM
beanz added inline comments.Feb 13 2023, 8:29 AM
llvm/lib/Target/DirectX/DXILPrepare.cpp
110

I'm not sure I agree with the approach of having a list of keys to delete. That seems maintenance-intensive and error prone.

Why not instead only maintain a list of valid string attributes for DXIL, and strip everything else?

llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
80

I think this makes sense, but I also think the DXILTranslateMetadataPass should be deleting the function attributes that it is translating.

Once we run the DXILTranslateMetadataPass any later passes that need information from that gets captured in the metadata should be reading it out of the preserved analysis. Having DXILTranslateMetadataPass delete the sources of where it read from will help us keep that working as expected.

Only keep debug related module flags which are used by DXIL.
Also let DXILPrepare pass preserve DXILResourceWrapper which is used in asm dump pass for test.

python3kgae marked 2 inline comments as done.Feb 13 2023, 9:52 AM
python3kgae added inline comments.
llvm/lib/Target/DirectX/DXILPrepare.cpp
110

Fixed.

llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
80

That is a good idea.
Do you mind do that in a separate PR?