This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Add missing physical register check in SIFoldOperands::tryFoldLoad
ClosedPublic

Authored by yassingh on Jan 16 2023, 11:07 PM.

Details

Summary

tryFoldLoad() is not meant to work on physical registers moreover
use_nodbg_instructions(reg) makes the compiler buggy when called with
physical reg

Fix for SWDEV-373493

Diff Detail

Event Timeline

yassingh created this revision.Jan 16 2023, 11:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 16 2023, 11:07 PM
yassingh requested review of this revision.Jan 16 2023, 11:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 16 2023, 11:07 PM

Could also use mir test

llvm/test/CodeGen/AMDGPU/swdev373493.ll
1

Don’t need -O3 and does need checks

7

Avoid branch on undef

30

Can drop attributes and metadata

yassingh updated this revision to Diff 490092.Jan 18 2023, 2:56 AM

Addressed Matt's comments

yassingh added inline comments.Jan 18 2023, 2:58 AM
llvm/test/CodeGen/AMDGPU/swdev373493.ll
7

I generated this test by reducing the huge test filed with the ticket. I'm unable to generate the compiler failure without undef here.

arsenm added inline comments.Jan 19 2023, 7:05 AM
llvm/test/CodeGen/AMDGPU/swdev373493.ll
5

opt -passes=metarenamer?

llvm/test/CodeGen/AMDGPU/swdev373493.mir
2 ↗(On Diff #490092)

This can be reduced, you can try llvm-reduce mir handling

yassingh updated this revision to Diff 490723.Jan 19 2023, 10:37 PM

Addressed review comments, updated MIR test

arsenm accepted this revision.Jan 20 2023, 5:57 AM
arsenm added inline comments.
llvm/test/CodeGen/AMDGPU/fold-vgpr-phyreg.mir
26–34 ↗(On Diff #490723)

If you use -run-pass=none, it will clean up and compact these register numbers for you

This revision is now accepted and ready to land.Jan 20 2023, 5:57 AM
yassingh updated this revision to Diff 491231.Jan 22 2023, 9:47 PM

Cleaned up MIR test

arsenm accepted this revision.Jan 23 2023, 1:48 PM
This revision was landed with ongoing or failed builds.Jan 24 2023, 12:55 AM
This revision was automatically updated to reflect the committed changes.