This is an archive of the discontinued LLVM Phabricator instance.

Check subrange liveness at rematerialization
ClosedPublic

Authored by rampitec on Dec 7 2021, 1:15 PM.

Details

Summary

LiveRangeEdit::allUsesAvailableAt checks that VNI at use is the same
as at the original use slot. However, the VNI can be the same while
a specific subrange needed for use can be dead at the new index.

This patch adds subrange liveness check if there is a subreg use.

Fixes: SWDEV-312810

Diff Detail

Event Timeline

rampitec created this revision.Dec 7 2021, 1:15 PM
rampitec requested review of this revision.Dec 7 2021, 1:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 7 2021, 1:15 PM
Herald added a subscriber: wdng. · View Herald Transcript
rampitec updated this revision to Diff 392542.Dec 7 2021, 2:36 PM
rampitec updated this revision to Diff 392550.Dec 7 2021, 2:56 PM
rampitec updated this revision to Diff 392881.Dec 8 2021, 12:38 PM

Added test with partially live subreg.

arsenm added inline comments.Dec 9 2021, 11:52 AM
llvm/lib/CodeGen/LiveRangeEdit.cpp
146–148

This isn't required?

llvm/test/CodeGen/AMDGPU/remat-dead-subreg.mir
4

Should include a brief description

rampitec updated this revision to Diff 393250.Dec 9 2021, 12:17 PM
rampitec marked an inline comment as done.

Added test description.

rampitec marked an inline comment as done.Dec 9 2021, 12:19 PM
rampitec added inline comments.
llvm/lib/CodeGen/LiveRangeEdit.cpp
146–148

This is early exit. No need to continue iterating over the rest of the subranges if we have already checked all lanes we need. In case of wide register tuples this shall be faster.

rampitec marked an inline comment as done.Dec 13 2021, 9:03 AM
arsenm accepted this revision.Dec 13 2021, 9:35 AM

LGTM

llvm/lib/CodeGen/LiveRangeEdit.cpp
146–148

Probably should comment this is just for early exit (I'm also skeptical this helps anything)

This revision is now accepted and ready to land.Dec 13 2021, 9:35 AM
rampitec updated this revision to Diff 393965.Dec 13 2021, 10:52 AM
rampitec marked an inline comment as done.

Added comment.

rampitec added inline comments.Dec 13 2021, 10:54 AM
llvm/lib/CodeGen/LiveRangeEdit.cpp
146–148

We have pretty wide tuples so the loop may have to process up to 32 subranges.

arsenm accepted this revision.Dec 13 2021, 10:58 AM
This revision was landed with ongoing or failed builds.Dec 13 2021, 11:12 AM
This revision was automatically updated to reflect the committed changes.