aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/MI
diff options
context:
space:
mode:
authorTim Renouf <tpr.llvm@botech.co.uk>2018-02-26 14:42:13 +0000
committerTim Renouf <tpr.llvm@botech.co.uk>2018-02-26 14:42:13 +0000
commitf40707a2db3b7abd26ac87191cb792e648f0ccb4 (patch)
treeb86e3c7faec417aec76fc16ae2f7c85ae08fa53e /llvm/unittests/MI
parent0b2f774be69dcfbccb70c77b70264f93a661a590 (diff)
downloadllvm-f40707a2db3b7abd26ac87191cb792e648f0ccb4.zip
llvm-f40707a2db3b7abd26ac87191cb792e648f0ccb4.tar.gz
llvm-f40707a2db3b7abd26ac87191cb792e648f0ccb4.tar.bz2
[LiveIntervals] Handle moving up dead partial write
Summary: In the test case, the machine scheduler moves a dead write to a subreg up into the middle of a segment of the overall reg's live range, where the segment had liveness only for other subregs in the reg. handleMoveUp created an invalid live range, causing an assert a bit later. This commit fixes it to handle that situation. The segment is split in two at the insertion point, and the part after the split, and any subsequent segments up to the old position, are changed to be defined by the moved def. V2: Better test. Subscribers: MatzeB, nhaehnle, llvm-commits Differential Revision: https://reviews.llvm.org/D43478 Change-Id: Ibc42445ddca84e79ad1f616401015d22bc63832e llvm-svn: 326087
Diffstat (limited to 'llvm/unittests/MI')
-rw-r--r--llvm/unittests/MI/LiveIntervalTest.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/unittests/MI/LiveIntervalTest.cpp b/llvm/unittests/MI/LiveIntervalTest.cpp
index d614c7f..a39fd7f 100644
--- a/llvm/unittests/MI/LiveIntervalTest.cpp
+++ b/llvm/unittests/MI/LiveIntervalTest.cpp
@@ -395,6 +395,31 @@ TEST(LiveIntervalTest, SubRegMoveUp) {
});
}
+TEST(LiveIntervalTest, DeadSubRegMoveUp) {
+ // handleMoveUp had a bug where moving a dead subreg def into the middle of
+ // an earlier segment resulted in an invalid live range.
+ liveIntervalTest(R"MIR(
+ undef %125.sub0:vreg_128 = V_MOV_B32_e32 0, implicit $exec
+ %125.sub1:vreg_128 = COPY %125.sub0
+ %125.sub2:vreg_128 = COPY %125.sub0
+ undef %51.sub0:vreg_128 = V_MOV_B32_e32 898625526, implicit $exec
+ %51.sub1:vreg_128 = COPY %51.sub0
+ %51.sub2:vreg_128 = COPY %51.sub0
+ %52:vgpr_32 = V_MOV_B32_e32 986714345, implicit $exec
+ %54:vgpr_32 = V_MOV_B32_e32 1742342378, implicit $exec
+ %57:vgpr_32 = V_MOV_B32_e32 3168768712, implicit $exec
+ %59:vgpr_32 = V_MOV_B32_e32 1039972644, implicit $exec
+ %60:vgpr_32 = V_MAD_F32 0, %52, 0, undef %61:vgpr_32, 0, %59, 0, 0, implicit $exec
+ %63:vgpr_32 = V_ADD_F32_e32 %51.sub3, undef %64:vgpr_32, implicit $exec
+ dead %66:vgpr_32 = V_MAD_F32 0, %60, 0, undef %67:vgpr_32, 0, %125.sub2, 0, 0, implicit $exec
+ undef %124.sub1:vreg_128 = V_MAD_F32 0, %57, 0, undef %70:vgpr_32, 0, %125.sub1, 0, 0, implicit $exec
+ %124.sub0:vreg_128 = V_MAD_F32 0, %54, 0, undef %73:vgpr_32, 0, %125.sub0, 0, 0, implicit $exec
+ dead undef %125.sub3:vreg_128 = V_MAC_F32_e32 %63, undef %76:vgpr_32, %125.sub3, implicit $exec
+)MIR", [](MachineFunction &MF, LiveIntervals &LIS) {
+ testHandleMove(MF, LIS, 15, 12);
+ });
+}
+
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
initLLVM();