[LiveIntervals] Fix repairOldRegInRange for simple def cases
authorJay Foad <jay.foad@amd.com>
Wed, 22 Sep 2021 11:14:18 +0000 (12:14 +0100)
committerJay Foad <jay.foad@amd.com>
Thu, 23 Sep 2021 16:16:14 +0000 (17:16 +0100)
commit8229cb74125322ff337cfe316ab35c6ebf412bde
treecdf621da557ec2021435d79ef7b2b9e21107483f
parentfd04fd9ac92d705f7d144b77109b8bcec950c04f
[LiveIntervals] Fix repairOldRegInRange for simple def cases

The fix applied in D23303 "LiveIntervalAnalysis: fix a crash in repairOldRegInRange"
was over-zealous. It would bail out when the end of the range to be
repaired was in the middle of the first segment of the live range of
Reg, which was always the case when the range contained a single def of
Reg.

This patch fixes it as suggested by Matthias Braun in post-commit review
on the original patch, and tests it by adding -early-live-intervals to
a selection of existing lit tests that now pass.

(Note that D23303 was originally applied to fix a crash in
SILoadStoreOptimizer, but that is now moot since D23814 updated
SILoadStoreOptimizer to run before scheduling so it no longer has to
update live intervals.)

Differential Revision: https://reviews.llvm.org/D110238
llvm/lib/CodeGen/LiveIntervals.cpp
llvm/test/CodeGen/AMDGPU/extract-load-i1.ll
llvm/test/CodeGen/AMDGPU/twoaddr-regsequence.mir [new file with mode: 0644]
llvm/test/CodeGen/ARM/signext-inreg.ll
llvm/test/CodeGen/X86/mul-shift-reassoc.ll