This is an archive of the discontinued LLVM Phabricator instance.

[LiveRange] Fix inaccurate verification of live-in PhysRegs
ClosedPublic

Authored by critson on Aug 4 2023, 5:07 AM.

Details

Summary

Fix verification that a PhysReg is live in to an MBB.
isLiveIn does not handle reg units, so cannot identify when a
register would be defined because its super register is partially
defined.
Additionally a PhysReg may be partial defined at block entry and
then fully defined before any use.

Diff Detail

Event Timeline

critson created this revision.Aug 4 2023, 5:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2023, 5:07 AM
critson requested review of this revision.Aug 4 2023, 5:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2023, 5:07 AM
foad added a comment.Aug 4 2023, 7:28 AM

Could you still check that at least one aliasing registers is in the liveins? (Much as I am loath to suggest new uses of MCRegAliasIterator.)

Do you have a test case? Does it only show up before PHIElimination, and if so why?

Could you still check that at least one aliasing registers is in the liveins? (Much as I am loath to suggest new uses of MCRegAliasIterator.)

Yes, we can check aliases -- this is only compiled with debug and so it's probably acceptable.

Do you have a test case? Does it only show up before PHIElimination, and if so why?

This happens during / post-RA; however, normally we do not generate/regenerate LiveIntervals at this point hence this is an edge case.

critson updated this revision to Diff 549799.Aug 13 2023, 11:02 PM
  • Rework to check aliases instead of removing check entirely
  • Add test cases
critson retitled this revision from [LiveRange] Remove inaccurate verification of live-in PhysRegs to [LiveRange] Fix inaccurate verification of live-in PhysRegs.Aug 13 2023, 11:02 PM
critson edited the summary of this revision. (Show Details)
foad accepted this revision.Aug 14 2023, 12:44 AM

Seems reasonable. I wonder if you could get an IR test with llc -early-live-intervals.

llvm/lib/CodeGen/LiveRangeCalc.cpp
223

This looks like a job for /*IncludeSelf=*/true, but I guess it wouldn't actually shorten the code much the way you've written it.

This revision is now accepted and ready to land.Aug 14 2023, 12:44 AM
arsenm accepted this revision.Aug 15 2023, 4:21 PM
This revision was landed with ongoing or failed builds.Aug 16 2023, 1:43 AM
This revision was automatically updated to reflect the committed changes.