• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llc -march=amdgcn -run-pass simple-register-coalescing -o - %s | FileCheck --check-prefix=GCN %s
2#
3# See bug http://llvm.org/PR33524 for details of the problem being checked here
4# This test will provoke a subrange join (see annotations below) during simple register coalescing
5# Without a fix for PR33524 this causes an unreachable in SubRange Join
6#
7# GCN-DAG: undef %[[REG0:[0-9]+]].sub0:sgpr_64 = COPY $sgpr5
8# GCN-DAG: undef %[[REG1:[0-9]+]].sub0:sgpr_64 = COPY $sgpr2
9# GCN-DAG: %[[REG0]].sub1:sgpr_64 = S_MOV_B32 1
10# GCN-DAG: %[[REG1]].sub1:sgpr_64 = S_MOV_B32 1
11
12--- |
13  define amdgpu_vs void @regcoal-subrange-join(i32 inreg %arg, i32 inreg %arg1, i32 inreg %arg2, i32 inreg %arg3, i32 inreg %arg4, i32 inreg %arg5, i32 %arg6) local_unnamed_addr #0 {
14    ret void
15  }
16
17...
18---
19name:            regcoal-subrange-join
20tracksRegLiveness: true
21registers:
22  - { id: 0, class: sreg_64 }
23  - { id: 1, class: vreg_128 }
24  - { id: 2, class: vreg_128 }
25  - { id: 3, class: vreg_128 }
26  - { id: 4, class: sreg_32_xm0 }
27  - { id: 5, class: sreg_32_xm0 }
28  - { id: 6, class: sreg_32_xm0, preferred-register: '%8' }
29  - { id: 7, class: vreg_128 }
30  - { id: 8, class: sreg_32_xm0, preferred-register: '%6' }
31  - { id: 9, class: vreg_128 }
32  - { id: 10, class: sgpr_32 }
33  - { id: 11, class: sgpr_32 }
34  - { id: 12, class: sgpr_32 }
35  - { id: 13, class: sgpr_32 }
36  - { id: 14, class: sgpr_32 }
37  - { id: 15, class: sgpr_32 }
38  - { id: 16, class: vgpr_32 }
39  - { id: 17, class: sreg_32_xm0 }
40  - { id: 18, class: sreg_64 }
41  - { id: 19, class: sreg_32_xm0 }
42  - { id: 20, class: sreg_32_xm0 }
43  - { id: 21, class: sreg_64 }
44  - { id: 22, class: sreg_32_xm0_xexec }
45  - { id: 23, class: sreg_32_xm0 }
46  - { id: 24, class: sreg_64_xexec }
47  - { id: 25, class: sgpr_128 }
48  - { id: 26, class: sreg_64_xexec }
49  - { id: 27, class: sreg_32_xm0_xexec }
50  - { id: 28, class: sreg_32_xm0 }
51  - { id: 29, class: vgpr_32 }
52  - { id: 30, class: vgpr_32 }
53  - { id: 31, class: vgpr_32 }
54  - { id: 32, class: vgpr_32 }
55  - { id: 33, class: vgpr_32 }
56  - { id: 34, class: vgpr_32 }
57  - { id: 35, class: vgpr_32 }
58  - { id: 36, class: vgpr_32 }
59  - { id: 37, class: vgpr_32 }
60  - { id: 38, class: sgpr_128 }
61  - { id: 39, class: sreg_64_xexec }
62  - { id: 40, class: sreg_32_xm0_xexec }
63  - { id: 41, class: sreg_32_xm0 }
64  - { id: 42, class: vgpr_32 }
65  - { id: 43, class: vgpr_32 }
66  - { id: 44, class: vgpr_32 }
67  - { id: 45, class: vgpr_32 }
68  - { id: 46, class: vgpr_32 }
69  - { id: 47, class: vgpr_32 }
70  - { id: 48, class: vgpr_32 }
71  - { id: 49, class: vgpr_32 }
72  - { id: 50, class: vgpr_32 }
73  - { id: 51, class: sgpr_128 }
74  - { id: 52, class: vgpr_32 }
75  - { id: 53, class: vgpr_32 }
76  - { id: 54, class: vgpr_32 }
77  - { id: 55, class: vgpr_32 }
78  - { id: 56, class: vreg_128 }
79  - { id: 57, class: vreg_128 }
80  - { id: 58, class: vreg_128 }
81  - { id: 59, class: sreg_32_xm0 }
82  - { id: 60, class: sreg_32_xm0 }
83  - { id: 61, class: vreg_128 }
84liveins:
85  - { reg: '$sgpr2', virtual-reg: '%12' }
86  - { reg: '$sgpr5', virtual-reg: '%15' }
87body:             |
88  bb.0:
89    liveins: $sgpr2, $sgpr5
90
91    %15 = COPY killed $sgpr5
92    %12 = COPY killed $sgpr2
93    %17 = S_MOV_B32 1
94    undef %18.sub1 = COPY %17
95    %0 = COPY %18
96    %0.sub0 = COPY killed %12
97    %21 = COPY killed %18
98    %21.sub0 = COPY killed %15
99    %22 = S_LOAD_DWORD_IMM killed %21, 2, 0, 0
100    %23 = S_MOV_B32 491436
101    undef %24.sub0 = COPY killed %22
102    %24.sub1 = COPY killed %23
103    %25 = S_LOAD_DWORDX4_IMM killed %24, 0, 0, 0
104    %1 = COPY killed %25
105    %26 = S_LOAD_DWORDX2_IMM %0, 2, 0, 0
106    dead %27 = S_LOAD_DWORD_IMM killed %26, 0, 0, 0
107    S_CBRANCH_SCC0 %bb.1, implicit undef $scc
108
109  bb.5:
110    %58 = COPY killed %1
111    %59 = COPY killed %17
112    S_BRANCH %bb.2
113
114  bb.1:
115    %30 = V_MOV_B32_e32 1036831949, implicit $exec
116    %31 = nofpexcept V_ADD_F32_e32 %30, %1.sub3, implicit $mode, implicit $exec
117    %33 = nofpexcept V_ADD_F32_e32 %30, %1.sub2, implicit $mode, implicit $exec
118    %35 = nofpexcept V_ADD_F32_e32 %30, %1.sub1, implicit $mode, implicit $exec
119    %37 = nofpexcept V_ADD_F32_e32 killed %30, killed %1.sub0, implicit $mode, implicit $exec
120    undef %56.sub0 = COPY killed %37
121    %56.sub1 = COPY killed %35
122    %56.sub2 = COPY killed %33
123    %56.sub3 = COPY killed %31
124    %28 = S_MOV_B32 0
125    %2 = COPY killed %56
126    %58 = COPY killed %2
127    %59 = COPY killed %28
128
129  bb.2:
130    %4 = COPY killed %59
131    %3 = COPY killed %58
132    %39 = S_LOAD_DWORDX2_IMM killed %0, 6, 0, 0
133    %40 = S_LOAD_DWORD_IMM killed %39, 0, 0, 0
134    %43 = V_MOV_B32_e32 -1102263091, implicit $exec
135    %60 = COPY killed %4
136    %61 = COPY killed %3
137
138  bb.3:
139    successors: %bb.3, %bb.4
140
141    %7 = COPY killed %61
142    %6 = COPY killed %60
143    %8 = S_ADD_I32 killed %6, 1, implicit-def dead $scc
144    %44 = nofpexcept V_ADD_F32_e32 %43, %7.sub3, implicit $mode, implicit $exec
145    %46 = nofpexcept V_ADD_F32_e32 %43, %7.sub2, implicit $mode, implicit $exec
146    %48 = nofpexcept V_ADD_F32_e32 %43, %7.sub1, implicit $mode, implicit $exec
147    %50 = nofpexcept V_ADD_F32_e32 %43, killed %7.sub0, implicit $mode, implicit $exec
148    undef %57.sub0 = COPY killed %50
149    %57.sub1 = COPY killed %48
150    %57.sub2 = COPY %46
151    %57.sub3 = COPY killed %44
152    S_CMP_LT_I32 %8, %40, implicit-def $scc
153    %60 = COPY killed %8
154    %61 = COPY killed %57
155    S_CBRANCH_SCC1 %bb.3, implicit killed $scc
156    S_BRANCH %bb.4
157
158  bb.4:
159    EXP 32, undef %53, undef %54, killed %46, undef %55, 0, 0, 15, implicit $exec
160    S_ENDPGM 0
161
162...
163