File: sink-after-control-flow-postra.mir

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (213 lines) | stat: -rw-r--r-- 7,424 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs -run-pass=postra-machine-sink -mattr=-wavefrontsize32,+wavefrontsize64 -o - %s | FileCheck -check-prefixes=GFX10 %s

# Ensure that PostRA Machine Sink does not sink instructions
# past block prologues which would overwrite their uses.

---
# Make sure COPY to $sgpr9 is not sunk after S_AND_SAVEEXEC_B64.
name:            _amdgpu_ps_main
alignment:       1
tracksRegLiveness: true
registers:       []
liveins:
  - { reg: '$sgpr4', virtual-reg: '' }
body:             |
  ; GFX10-LABEL: name: _amdgpu_ps_main
  ; GFX10: bb.0:
  ; GFX10-NEXT:   successors: %bb.1(0x80000000)
  ; GFX10-NEXT:   liveins: $sgpr4
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT:   renamable $sgpr9 = COPY $sgpr4
  ; GFX10-NEXT:   renamable $vgpr5 = IMPLICIT_DEF
  ; GFX10-NEXT:   renamable $sgpr0_sgpr1 = nofpexcept V_CMP_NGT_F32_e64 0, 0, 0, $vgpr5, 0, implicit $mode, implicit $exec
  ; GFX10-NEXT:   S_BRANCH %bb.1
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT: bb.1:
  ; GFX10-NEXT:   successors: %bb.2(0x40000000), %bb.3(0x40000000)
  ; GFX10-NEXT:   liveins: $sgpr6, $sgpr9, $sgpr0_sgpr1
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT:   $sgpr4_sgpr5 = S_AND_SAVEEXEC_B64 $sgpr0_sgpr1, implicit-def $exec, implicit-def $scc, implicit $exec
  ; GFX10-NEXT:   renamable $sgpr14_sgpr15 = S_XOR_B64 $exec, killed renamable $sgpr4_sgpr5, implicit-def dead $scc
  ; GFX10-NEXT:   S_CBRANCH_EXECZ %bb.3, implicit $exec
  ; GFX10-NEXT:   S_BRANCH %bb.2
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT: bb.2:
  ; GFX10-NEXT:   successors: %bb.3(0x80000000)
  ; GFX10-NEXT:   liveins: $sgpr6
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT:   $m0 = COPY killed renamable $sgpr6
  ; GFX10-NEXT:   S_BRANCH %bb.3
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT: bb.3:
  ; GFX10-NEXT:   S_ENDPGM 0
  bb.0:
    successors: %bb.1(0x80000000)
    liveins: $sgpr4

    renamable $sgpr9 = COPY $sgpr4
    renamable $vgpr5 = IMPLICIT_DEF
    renamable $sgpr0_sgpr1 = nofpexcept V_CMP_NGT_F32_e64 0, 0, 0, $vgpr5, 0, implicit $mode, implicit $exec
    S_BRANCH %bb.1

  bb.1:
    successors: %bb.2(0x40000000), %bb.8(0x40000000)
    liveins: $sgpr6, $sgpr9, $sgpr0_sgpr1

    $sgpr4_sgpr5 = S_AND_SAVEEXEC_B64 $sgpr0_sgpr1, implicit-def $exec, implicit-def $scc, implicit $exec
    renamable $sgpr14_sgpr15 = S_XOR_B64 $exec, killed renamable $sgpr4_sgpr5, implicit-def dead $scc
    S_CBRANCH_EXECZ %bb.8, implicit $exec
    S_BRANCH %bb.2

  bb.2:
    successors: %bb.8(0x40000000)
    liveins: $sgpr6

    $m0 = COPY killed renamable $sgpr6
    S_BRANCH %bb.8

  bb.8:

    S_ENDPGM 0

...
---
# Make sure COPY to $sgpr0_sgpr1 is not sunk after S_AND_SAVEEXEC_B64.
name:            _amdgpu_ps_main2
alignment:       1
tracksRegLiveness: true
registers:       []
liveins:
  - { reg: '$sgpr4', virtual-reg: '' }
  - { reg: '$sgpr6_sgpr7', virtual-reg: '' }
body:             |
  ; GFX10-LABEL: name: _amdgpu_ps_main2
  ; GFX10: bb.0:
  ; GFX10-NEXT:   successors: %bb.1(0x80000000)
  ; GFX10-NEXT:   liveins: $sgpr4, $sgpr6_sgpr7
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT:   renamable $sgpr9 = COPY $sgpr4
  ; GFX10-NEXT:   renamable $vgpr5 = IMPLICIT_DEF
  ; GFX10-NEXT:   renamable $sgpr0_sgpr1 = COPY $sgpr6_sgpr7
  ; GFX10-NEXT:   S_BRANCH %bb.1
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT: bb.1:
  ; GFX10-NEXT:   successors: %bb.2(0x40000000), %bb.3(0x40000000)
  ; GFX10-NEXT:   liveins: $sgpr6, $sgpr9, $sgpr0_sgpr1
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT:   $sgpr4_sgpr5 = S_AND_SAVEEXEC_B64 $sgpr0_sgpr1, implicit-def $exec, implicit-def $scc, implicit $exec
  ; GFX10-NEXT:   renamable $sgpr14_sgpr15 = S_XOR_B64 $exec, killed renamable $sgpr4_sgpr5, implicit-def dead $scc
  ; GFX10-NEXT:   S_CBRANCH_EXECZ %bb.3, implicit $exec
  ; GFX10-NEXT:   S_BRANCH %bb.2
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT: bb.2:
  ; GFX10-NEXT:   successors: %bb.3(0x80000000)
  ; GFX10-NEXT:   liveins: $sgpr6
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT:   $m0 = COPY killed renamable $sgpr6
  ; GFX10-NEXT:   S_BRANCH %bb.3
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT: bb.3:
  ; GFX10-NEXT:   S_ENDPGM 0
  bb.0:
    successors: %bb.1(0x80000000)
    liveins: $sgpr4, $sgpr6_sgpr7

    renamable $sgpr9 = COPY $sgpr4
    renamable $vgpr5 = IMPLICIT_DEF
    renamable $sgpr0_sgpr1 = COPY $sgpr6_sgpr7
    S_BRANCH %bb.1

  bb.1:
    successors: %bb.2(0x40000000), %bb.8(0x40000000)
    liveins: $sgpr6, $sgpr9, $sgpr0_sgpr1

    $sgpr4_sgpr5 = S_AND_SAVEEXEC_B64 $sgpr0_sgpr1, implicit-def $exec, implicit-def $scc, implicit $exec
    renamable $sgpr14_sgpr15 = S_XOR_B64 $exec, killed renamable $sgpr4_sgpr5, implicit-def dead $scc
    S_CBRANCH_EXECZ %bb.8, implicit $exec
    S_BRANCH %bb.2

  bb.2:
    successors: %bb.8(0x40000000)
    liveins: $sgpr6

    $m0 = COPY killed renamable $sgpr6
    S_BRANCH %bb.8

  bb.8:

    S_ENDPGM 0

...
---
# Make sure COPY to $sgpr2_sgpr3 is not sunk after S_AND_SAVEEXEC_B32.
name:            _amdgpu_ps_main3
alignment:       1
tracksRegLiveness: true
registers:       []
liveins:
  - { reg: '$sgpr6_sgpr7', virtual-reg: '' }
  - { reg: '$sgpr8', virtual-reg: '' }
body:             |
  ; GFX10-LABEL: name: _amdgpu_ps_main3
  ; GFX10: bb.0:
  ; GFX10-NEXT:   successors: %bb.1(0x80000000)
  ; GFX10-NEXT:   liveins: $sgpr6_sgpr7, $sgpr8
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT:   renamable $vgpr5 = IMPLICIT_DEF
  ; GFX10-NEXT:   renamable $sgpr0_sgpr1 = IMPLICIT_DEF
  ; GFX10-NEXT:   renamable $sgpr2_sgpr3 = COPY $sgpr6_sgpr7
  ; GFX10-NEXT:   S_BRANCH %bb.1
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT: bb.1:
  ; GFX10-NEXT:   successors: %bb.2(0x40000000), %bb.3(0x40000000)
  ; GFX10-NEXT:   liveins: $sgpr6, $sgpr8, $sgpr0_sgpr1, $sgpr2_sgpr3
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT:   $sgpr2 = S_AND_SAVEEXEC_B32 $sgpr8, implicit-def $exec, implicit-def $scc, implicit $exec
  ; GFX10-NEXT:   $sgpr4_sgpr5 = S_AND_SAVEEXEC_B64 $sgpr0_sgpr1, implicit-def $exec, implicit-def $scc, implicit $exec
  ; GFX10-NEXT:   renamable $sgpr14_sgpr15 = S_XOR_B64 $exec, killed renamable $sgpr4_sgpr5, implicit-def dead $scc
  ; GFX10-NEXT:   S_NOP 0, implicit $sgpr2_sgpr3
  ; GFX10-NEXT:   S_CBRANCH_EXECZ %bb.3, implicit $exec
  ; GFX10-NEXT:   S_BRANCH %bb.2
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT: bb.2:
  ; GFX10-NEXT:   successors: %bb.3(0x80000000)
  ; GFX10-NEXT:   liveins: $sgpr6
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT:   $m0 = COPY killed renamable $sgpr6
  ; GFX10-NEXT:   S_BRANCH %bb.3
  ; GFX10-NEXT: {{  $}}
  ; GFX10-NEXT: bb.3:
  ; GFX10-NEXT:   S_ENDPGM 0
  bb.0:
    successors: %bb.1(0x80000000)
    liveins: $sgpr6_sgpr7, $sgpr8

    renamable $vgpr5 = IMPLICIT_DEF
    renamable $sgpr0_sgpr1 = IMPLICIT_DEF
    renamable $sgpr2_sgpr3 = COPY $sgpr6_sgpr7
    S_BRANCH %bb.1

  bb.1:
    successors: %bb.2(0x40000000), %bb.8(0x40000000)
    liveins: $sgpr6, $sgpr8, $sgpr0_sgpr1, $sgpr2_sgpr3

    $sgpr2 = S_AND_SAVEEXEC_B32 $sgpr8, implicit-def $exec, implicit-def $scc, implicit $exec
    $sgpr4_sgpr5 = S_AND_SAVEEXEC_B64 $sgpr0_sgpr1, implicit-def $exec, implicit-def $scc, implicit $exec
    renamable $sgpr14_sgpr15 = S_XOR_B64 $exec, killed renamable $sgpr4_sgpr5, implicit-def dead $scc
    S_NOP 0, implicit $sgpr2_sgpr3
    S_CBRANCH_EXECZ %bb.8, implicit $exec
    S_BRANCH %bb.2

  bb.2:
    successors: %bb.8(0x40000000)
    liveins: $sgpr6

    $m0 = COPY killed renamable $sgpr6
    S_BRANCH %bb.8

  bb.8:

    S_ENDPGM 0

...