1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass register-coalescer -verify-machineinstrs -o - %s | FileCheck %s
4 # The failure occurs when the coalescer tries to removePartialRedundency() on the
5 # "%2:vreg_64 = COPY %3" in bb.1. The coalescer tries to prune and extend each
6 # subrange of %2, the subrange for %2.sub1 has a def location (in bb.2) in the
7 # predecessor path 2->3->1. But for another predecessor path 0->4->1,
8 # the subrange has only one undef location in bb.0. If we don't compute Undef set,
9 # it will fail to find the reaching def for %2.sub1 in predecessor bb.4 and bb.0
10 # and crash with error message:
11 # "Use of $noreg does not have a corresponding definition on every path
12 # LLVM ERROR: Use not jointly dominated by defs"
17 tracksRegLiveness: true
19 ; CHECK-LABEL: name: _amdgpu_ps_main
21 ; CHECK-NEXT: successors: %bb.2(0x40000000), %bb.4(0x40000000)
22 ; CHECK-NEXT: liveins: $sgpr2, $sgpr3, $vgpr3
24 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr_32 = COPY $sgpr2
25 ; CHECK-NEXT: undef %1.sub0:vreg_64 = COPY [[COPY]]
26 ; CHECK-NEXT: undef %2.sub0:vreg_64 = COPY [[COPY]]
27 ; CHECK-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit undef $vcc
28 ; CHECK-NEXT: S_BRANCH %bb.4
31 ; CHECK-NEXT: successors: %bb.2(0x80000000)
33 ; CHECK-NEXT: S_NOP 0, implicit %2.sub0
36 ; CHECK-NEXT: successors: %bb.3(0x04000000), %bb.2(0x7c000000)
38 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vreg_64 = COPY %2
39 ; CHECK-NEXT: %1.sub0:vreg_64 = COPY [[COPY1]].sub0
40 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vreg_64 = COPY %1
41 ; CHECK-NEXT: S_CBRANCH_EXECNZ %bb.2, implicit undef $exec
42 ; CHECK-NEXT: S_BRANCH %bb.3
45 ; CHECK-NEXT: successors: %bb.1(0x80000000)
47 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:vreg_64 = COPY [[COPY1]]
48 ; CHECK-NEXT: S_BRANCH %bb.1
51 ; CHECK-NEXT: successors: %bb.1(0x80000000)
53 ; CHECK-NEXT: S_BRANCH %bb.1
55 liveins: $sgpr2, $sgpr3, $vgpr3
57 %0:sgpr_32 = COPY $sgpr2
58 undef %1.sub0:vreg_64 = COPY %0
59 undef %2.sub0:vreg_64 = COPY %0
60 S_CBRANCH_VCCNZ %bb.2, implicit undef $vcc
65 S_NOP 0, implicit %2.sub0
68 successors: %bb.3(0x04000000), %bb.2(0x7c000000)
71 %1.sub0:vreg_64 = COPY %3.sub0
73 S_CBRANCH_EXECNZ %bb.2, implicit undef $exec