This is an archive of the discontinued LLVM Phabricator instance.

[LiveIntervals] Repair live intervals that gain subranges
ClosedPublic

Authored by foad on Sep 23 2021, 6:09 AM.

Details

Summary

In repairIntervalsInRange, if the new instructions refer to subregs but
the old instructions did not, make sure any existing live interval for
the superreg is updated to have subranges. Also skip repairing any range
that we have recalculated from scratch, partly for efficiency but also
to avoids some cases that repairOldRegInRange can't handle.

The existing test/CodeGen/AMDGPU/twoaddr-regsequence.mir provides some
test coverage for this change: when TwoAddressInstructionPass converts
REG_SEQUENCE into subreg copies, the live intervals will now get
subranges and MachineVerifier will verify that the subranges are
correct. Unfortunately MachineVerifier does not complain if the
subranges are not present, so the test also passed before this patch.

This patch also fixes ~800 of the ~1500 failures in the whole CodeGen
lit test suite when -early-live-intervals is forced on.

Diff Detail

Event Timeline

foad created this revision.Sep 23 2021, 6:09 AM
foad requested review of this revision.Sep 23 2021, 6:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 23 2021, 6:09 AM
arsenm added inline comments.Sep 23 2021, 8:14 AM
llvm/lib/CodeGen/LiveIntervals.cpp
1699–1700

Re-use Reg variable

foad updated this revision to Diff 374564.Sep 23 2021, 8:19 AM

Reuse Reg.

foad marked an inline comment as done.Sep 23 2021, 8:19 AM
arsenm accepted this revision.Sep 23 2021, 9:36 AM
This revision is now accepted and ready to land.Sep 23 2021, 9:36 AM
This revision was landed with ongoing or failed builds.Sep 24 2021, 4:02 AM
This revision was automatically updated to reflect the committed changes.