[LiveIntervals] Repair live intervals that gain subranges
authorJay Foad <jay.foad@amd.com>
Thu, 23 Sep 2021 07:24:28 +0000 (08:24 +0100)
committerJay Foad <jay.foad@amd.com>
Fri, 24 Sep 2021 10:58:08 +0000 (11:58 +0100)
commite4e95f14f15aceb2641c2b917eca58aaf988c4a7
tree6f12d7c792fa1d0c1a28305c9e1fc231ab765a67
parent7863cc6c1c9e714de666f7df84fe9ef6ea7bb06c
[LiveIntervals] Repair live intervals that gain subranges

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.

Differential Revision: https://reviews.llvm.org/D110328
llvm/lib/CodeGen/LiveIntervals.cpp
llvm/test/CodeGen/AMDGPU/amdgpu-mul24-knownbits.ll
llvm/test/CodeGen/Hexagon/isel-extload-i1.ll
llvm/test/CodeGen/Thumb2/mve-ctlz.ll