1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
2 # RUN: llc -mtriple=i386-unknown-linux-gnu -verify-coalescing -run-pass=register-coalescer -o - %s | FileCheck %s
4 # Make sure no verifier error is produced from coalescing the identity
5 # copy in bb.3 with live out implicit_defs. The value is live out of
6 # the block, and the incoming value is a phi def.
9 name: pr38795_verifier_error_reduced_1
10 tracksRegLiveness: true
12 ; CHECK-LABEL: name: pr38795_verifier_error_reduced_1
14 ; CHECK-NEXT: successors: %bb.1(0x80000000)
15 ; CHECK-NEXT: liveins: $eax
17 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $eax
20 ; CHECK-NEXT: successors: %bb.3(0x40000000), %bb.2(0x40000000)
22 ; CHECK-NEXT: [[DEF:%[0-9]+]]:gr32 = IMPLICIT_DEF
23 ; CHECK-NEXT: JCC_1 %bb.3, 4, implicit undef $eflags
26 ; CHECK-NEXT: successors: %bb.3(0x80000000)
28 ; CHECK-NEXT: [[MOV32r0_:%[0-9]+]]:gr32 = MOV32r0 implicit-def dead $eflags
31 ; CHECK-NEXT: successors: %bb.5(0x40000000), %bb.4(0x40000000)
33 ; CHECK-NEXT: JCC_1 %bb.5, 4, implicit undef $eflags
36 ; CHECK-NEXT: successors: %bb.5(0x80000000)
38 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY [[MOV32r0_]]
41 ; CHECK-NEXT: successors: %bb.1(0x80000000)
43 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr32 = COPY [[COPY]]
44 ; CHECK-NEXT: JMP_1 %bb.1
50 %1:gr32 = IMPLICIT_DEF
51 JCC_1 %bb.3, 4, implicit undef $eflags
54 %0:gr32 = MOV32r0 implicit-def dead $eflags
58 JCC_1 %bb.5, 4, implicit undef $eflags
64 %0:gr32 = COPY killed %1
69 # Check for "Instruction ending live segment doesn't read the
70 # register" verifier error after coalescing
71 # This still failed with a similar error after a preliminary fix was
72 # attempted for pr38795_verifier_error_reduced_1
75 name: pr38795_verifier_error_reduced_2
76 tracksRegLiveness: true
78 ; CHECK-LABEL: name: pr38795_verifier_error_reduced_2
80 ; CHECK-NEXT: successors: %bb.1(0x80000000)
82 ; CHECK-NEXT: [[DEF:%[0-9]+]]:gr32 = IMPLICIT_DEF
85 ; CHECK-NEXT: successors: %bb.3(0x40000000), %bb.2(0x40000000)
87 ; CHECK-NEXT: [[DEF1:%[0-9]+]]:gr32 = IMPLICIT_DEF
88 ; CHECK-NEXT: JCC_1 %bb.3, 4, implicit killed undef $eflags
91 ; CHECK-NEXT: successors: %bb.9(0x80000000)
93 ; CHECK-NEXT: JMP_1 %bb.9
96 ; CHECK-NEXT: successors: %bb.5(0x40000000), %bb.4(0x40000000)
98 ; CHECK-NEXT: JCC_1 %bb.5, 5, implicit killed undef $eflags
101 ; CHECK-NEXT: successors: %bb.6(0x80000000)
103 ; CHECK-NEXT: [[MOV32r0_:%[0-9]+]]:gr32 = MOV32r0 implicit-def dead $eflags
104 ; CHECK-NEXT: JMP_1 %bb.6
107 ; CHECK-NEXT: successors: %bb.9(0x80000000)
109 ; CHECK-NEXT: [[DEF1:%[0-9]+]]:gr32 = IMPLICIT_DEF
110 ; CHECK-NEXT: JMP_1 %bb.9
113 ; CHECK-NEXT: successors: %bb.8(0x40000000), %bb.7(0x40000000)
115 ; CHECK-NEXT: JCC_1 %bb.8, 4, implicit killed undef $eflags
118 ; CHECK-NEXT: successors: %bb.8(0x80000000)
120 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY [[DEF1]]
123 ; CHECK-NEXT: successors: %bb.1(0x80000000)
125 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr32 = COPY [[COPY]]
126 ; CHECK-NEXT: JMP_1 %bb.1
129 ; CHECK-NEXT: successors: %bb.6(0x80000000)
131 ; CHECK-NEXT: JMP_1 %bb.6
133 %0:gr32 = IMPLICIT_DEF
136 %1:gr32 = IMPLICIT_DEF
137 JCC_1 %bb.3, 4, implicit killed undef $eflags
140 %2:gr32 = COPY killed %0
144 JCC_1 %bb.5, 5, implicit killed undef $eflags
147 %3:gr32 = MOV32r0 implicit-def dead $eflags
151 %2:gr32 = IMPLICIT_DEF
155 JCC_1 %bb.8, 4, implicit killed undef $eflags
158 %1:gr32 = COPY killed %3
161 %4:gr32 = COPY killed %1
162 %0:gr32 = COPY killed %4
166 %3:gr32 = COPY killed %2
171 # Still failed after patch for first 2 failures
174 name: pr38795_verifier_error_reduced_3
175 tracksRegLiveness: true
177 ; CHECK-LABEL: name: pr38795_verifier_error_reduced_3
179 ; CHECK-NEXT: successors: %bb.5(0x40000000), %bb.1(0x40000000)
181 ; CHECK-NEXT: [[DEF:%[0-9]+]]:gr32 = IMPLICIT_DEF
182 ; CHECK-NEXT: [[DEF1:%[0-9]+]]:gr32 = IMPLICIT_DEF
183 ; CHECK-NEXT: JCC_1 %bb.5, 4, implicit killed undef $eflags
186 ; CHECK-NEXT: successors: %bb.4(0x40000000), %bb.5(0x40000000)
188 ; CHECK-NEXT: [[DEF2:%[0-9]+]]:gr32 = IMPLICIT_DEF
189 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY [[DEF]]
190 ; CHECK-NEXT: [[MOV32r0_:%[0-9]+]]:gr32 = MOV32r0 implicit-def dead $eflags
191 ; CHECK-NEXT: JCC_1 %bb.4, 5, implicit killed undef $eflags
192 ; CHECK-NEXT: JMP_1 %bb.5
195 ; CHECK-NEXT: successors: %bb.4(0x40000000), %bb.3(0x40000000)
197 ; CHECK-NEXT: TEST32rr undef [[COPY]], [[COPY]], implicit-def $eflags
198 ; CHECK-NEXT: [[DEF1:%[0-9]+]]:gr32 = IMPLICIT_DEF
199 ; CHECK-NEXT: JCC_1 %bb.4, 4, implicit killed undef $eflags
202 ; CHECK-NEXT: successors: %bb.4(0x80000000)
204 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr32 = COPY [[MOV32r0_]]
207 ; CHECK-NEXT: successors: %bb.1(0x80000000)
209 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gr32 = COPY [[COPY1]]
210 ; CHECK-NEXT: JMP_1 %bb.1
213 ; CHECK-NEXT: successors: %bb.2(0x80000000)
215 ; CHECK-NEXT: JMP_1 %bb.2
217 %0:gr32 = IMPLICIT_DEF
218 %1:gr32 = IMPLICIT_DEF
219 JCC_1 %bb.5, 4, implicit killed undef $eflags
222 %2:gr32 = IMPLICIT_DEF
223 %1:gr32 = COPY killed %0
224 %0:gr32 = MOV32r0 implicit-def dead $eflags
225 JCC_1 %bb.4, 5, implicit killed undef $eflags
229 TEST32rr undef %1, %1, implicit-def $eflags
230 %2:gr32 = IMPLICIT_DEF
231 JCC_1 %bb.4, 4, implicit killed undef $eflags
234 %2:gr32 = COPY killed %0
237 %0:gr32 = COPY killed %2