1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -run-pass simple-register-coalescing %s -systemz-subreg-liveness -O3 -mtriple s390x-ibm-linux -mcpu z13 -o - | FileCheck %s
4 # When the coalescing tries to coalesce `%20 = COPY %18`,
5 # %18 has been coalesced all the way up to %15 = ROSBG.
6 # ROSBG has tied operands and can be commuted, thus it
7 # maybe possible to swap the arguments of ROSBG to coalesce
8 # this copy. That's what the coalescer attempts.
10 # This used to produce an assertion failure in the coalescer,
11 # because this particular coalescing trick is used only on
12 # full copy. Therefore we were asserting that all the subranges
13 # at the point of the copy had a value number.
14 # This is actually not true in that example, because %18 is
15 # only partial defined before being fully copied.
21 tracksRegLiveness: true
22 machineFunctionInfo: {}
24 ; CHECK-LABEL: name: main
26 ; CHECK: successors: %bb.1(0x80000000)
27 ; CHECK: [[LGHI:%[0-9]+]]:addr64bit = LGHI -30
28 ; CHECK: [[LHIMux:%[0-9]+]]:grx32bit = LHIMux 1
29 ; CHECK: [[LHIMux1:%[0-9]+]]:grx32bit = LHIMux 0
30 ; CHECK: undef %20.subreg_l32:gr64bit = IMPLICIT_DEF
32 ; CHECK: successors: %bb.3(0x00000001), %bb.4(0x7fffffff)
33 ; CHECK: CHIMux [[LHIMux]], 0, implicit-def $cc
34 ; CHECK: BRC 14, 6, %bb.3, implicit killed $cc
38 ; CHECK: STMux %20.subreg_l32, undef %8:addr64bit, 0, $noreg :: (store 4 into `i32* undef`)
42 ; CHECK: successors: %bb.5(0x30000000), %bb.6(0x50000000)
43 ; CHECK: [[LAY:%[0-9]+]]:gr64bit = LAY [[LGHI]], 19838, $noreg
44 ; CHECK: [[LAY1:%[0-9]+]]:gr64bit = LAY [[LGHI]], 19840, $noreg
45 ; CHECK: [[LAY2:%[0-9]+]]:gr64bit = LAY [[LGHI]], 19844, $noreg
46 ; CHECK: [[OGR:%[0-9]+]]:gr64bit = OGR [[OGR]], [[LAY]], implicit-def dead $cc
47 ; CHECK: undef %19.subreg_l32:gr64bit = AHIMuxK [[LGHI]].subreg_l32, 19843, implicit-def dead $cc
48 ; CHECK: [[ROSBG:%[0-9]+]]:gr64bit = ROSBG [[ROSBG]], [[OGR]], 32, 63, 0, implicit-def dead $cc
49 ; The coalescer should have been able to swap the operands of
50 ; the OR, hence eliminating the copy of %20 and %18.
51 ; This is also visible here because the ROSBG operand was LHS
52 ; before the coalescer, now it is RHS.
53 ; CHECK: %20.subreg_l32:gr64bit = OR %20.subreg_l32, [[ROSBG]].subreg_l32, implicit-def dead $cc
54 ; CHECK: [[ROSBG1:%[0-9]+]]:gr64bit = ROSBG [[ROSBG1]], [[LAY1]], 32, 63, 0, implicit-def dead $cc
55 ; CHECK: CHIMux [[LHIMux1]], 0, implicit-def $cc
56 ; CHECK: BRC 14, 6, %bb.6, implicit killed $cc
59 ; CHECK: successors: %bb.6(0x80000000)
61 ; CHECK: successors: %bb.2(0x00000001), %bb.7(0x7fffffff)
62 ; CHECK: [[LGHI]]:addr64bit = nuw nsw LA [[LGHI]], 6, $noreg
63 ; CHECK: CGHI [[LGHI]], 0, implicit-def $cc
64 ; CHECK: BRC 14, 8, %bb.2, implicit killed $cc
66 ; CHECK: successors: %bb.1(0x80000000)
70 %8:grx32bit = LHIMux 1
71 %21:grx32bit = LHIMux 0
72 %23:addr64bit = COPY killed %6
73 %24:gr32bit = IMPLICIT_DEF
76 successors: %bb.3(0x00000001), %bb.4(0x7fffffff)
78 %1:gr32bit = COPY killed %24
79 %0:addr64bit = COPY killed %23
80 CHIMux %8, 0, implicit-def $cc
81 BRC 14, 6, %bb.3, implicit killed $cc
87 STMux killed %4, undef %22:addr64bit, 0, $noreg :: (store 4 into `i32* undef`)
94 successors: %bb.5(0x30000000), %bb.6(0x50000000)
96 %2:gr64bit = LAY %0, 19838, $noreg
97 %3:gr64bit = LAY %0, 19840, $noreg
98 %9:gr64bit = LAY %0, 19844, $noreg
99 %10:gr64bit = COPY killed %9
100 %10:gr64bit = OGR %10, killed %2, implicit-def dead $cc
101 %11:gr32bit = COPY %0.subreg_l32
102 %12:gr32bit = AHIMuxK killed %11, 19843, implicit-def dead $cc
103 undef %13.subreg_l32:gr64bit = COPY killed %12
104 %15:gr64bit = COPY killed %13
105 %15:gr64bit = ROSBG %15, killed %10, 32, 63, 0, implicit-def dead $cc
106 %16:gr32bit = COPY killed %15.subreg_l32
107 %17:gr32bit = COPY killed %16
108 %17:gr32bit = OR %17, killed %1, implicit-def dead $cc
109 undef %18.subreg_l32:gr64bit = COPY killed %17
110 %20:gr64bit = COPY killed %18
111 %20:gr64bit = ROSBG %20, killed %3, 32, 63, 0, implicit-def dead $cc
112 CHIMux %21, 0, implicit-def $cc
113 BRC 14, 6, %bb.6, implicit killed $cc
119 successors: %bb.2(0x00000001), %bb.7(0x7fffffff)
121 %4:grx32bit = COPY killed %20.subreg_l32
122 %5:gr64bit = nuw nsw LA killed %0, 6, $noreg
123 CGHI %5, 0, implicit-def $cc
124 BRC 14, 8, %bb.2, implicit killed $cc
127 %23:addr64bit = COPY killed %5
128 %24:gr32bit = COPY killed %4