1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -march=amdgcn -o - -run-pass=block-placement -mcpu=gfx1010 -mattr=-inst-fwd-prefetch-bug -verify-machineinstrs %s | FileCheck -check-prefix=GCN %s
3
4# Used to fail with
5# Assertion `Out && "Header of loop has no predecessors from outside loop?"
6
7---
8name:            loop_header_nopred
9body:             |
10  ; GCN-LABEL: name: loop_header_nopred
11  ; GCN: bb.0:
12  ; GCN:   successors: %bb.1(0x80000000)
13  ; GCN:   S_INST_PREFETCH 1
14  ; GCN:   S_BRANCH %bb.1
15  ; GCN: bb.6 (align 64):
16  ; GCN:   successors: %bb.7(0x04000000), %bb.1(0x7c000000)
17  ; GCN:   S_CBRANCH_VCCNZ %bb.7, implicit $vcc
18  ; GCN: bb.1:
19  ; GCN:   successors: %bb.2(0x40000000), %bb.3(0x40000000)
20  ; GCN:   S_CBRANCH_VCCNZ %bb.2, implicit $vcc
21  ; GCN: bb.3:
22  ; GCN:   successors: %bb.4(0x40000000), %bb.6(0x40000000)
23  ; GCN:   SI_MASK_BRANCH %bb.6, implicit $exec
24  ; GCN:   S_BRANCH %bb.4
25  ; GCN: bb.2 (align 64):
26  ; GCN:   successors: %bb.4(0x40000000), %bb.6(0x40000000)
27  ; GCN:   SI_MASK_BRANCH %bb.6, implicit $exec
28  ; GCN:   S_BRANCH %bb.4
29  ; GCN: bb.4:
30  ; GCN:   successors: %bb.5(0x04000000), %bb.4(0x7c000000)
31  ; GCN:   S_NOP 0
32  ; GCN:   S_NOP 0
33  ; GCN:   S_NOP 0
34  ; GCN:   S_NOP 0
35  ; GCN:   S_NOP 0
36  ; GCN:   S_NOP 0
37  ; GCN:   S_NOP 0
38  ; GCN:   S_NOP 0
39  ; GCN:   S_NOP 0
40  ; GCN:   S_NOP 0
41  ; GCN:   S_NOP 0
42  ; GCN:   S_CBRANCH_EXECZ %bb.4, implicit $exec
43  ; GCN: bb.5:
44  ; GCN:   successors: %bb.6(0x80000000)
45  ; GCN:   S_BRANCH %bb.6
46  ; GCN: bb.7:
47  ; GCN:   S_ENDPGM 0
48  bb.0:
49    successors: %bb.1(0x80000000)
50
51  bb.1:
52    successors: %bb.2(0x40000000), %bb.3(0x40000000)
53
54    S_CBRANCH_VCCZ %bb.3, implicit $vcc
55    S_BRANCH %bb.2
56
57  bb.2:
58    successors: %bb.3(0x80000000)
59
60  bb.3:
61    successors: %bb.4(0x40000000), %bb.6(0x40000000)
62
63    SI_MASK_BRANCH %bb.6, implicit $exec
64    S_BRANCH %bb.4
65
66  bb.4:
67    successors: %bb.5(0x04000000), %bb.4(0x7c000000)
68
69    S_NOP 0
70    S_NOP 0
71    S_NOP 0
72    S_NOP 0
73    S_NOP 0
74    S_NOP 0
75    S_NOP 0
76    S_NOP 0
77    S_NOP 0
78    S_NOP 0
79    S_NOP 0
80    S_CBRANCH_EXECZ %bb.4, implicit $exec
81
82  bb.5:
83    successors: %bb.6(0x80000000)
84
85  bb.6:
86    successors: %bb.7(0x04000000), %bb.1(0x7c000000)
87
88    S_CBRANCH_VCCZ %bb.1, implicit $vcc
89
90  bb.7:
91    S_ENDPGM 0
92...
93