1+ // RUN: mlir-opt -load-pass-plugin=%mlir_lib_dir/ExamplePass_Kozlova_Ekaterina_FIIT3_MLIR%shlibext \
2+ // RUN: --pass-pipeline="builtin.module(ExamplePass_Kozlova_Ekaterina_FIIT3_MLIR)" %s | FileCheck %s
3+
4+ // CHECK: module {
5+
6+ // CHECK-LABEL: func.func @no_iterations() {
7+ // CHECK-NOT: my_loop_depths
8+ // CHECK-NEXT: return
9+ // CHECK-NEXT: }
10+ func.func @no_iterations () {
11+ return
12+ }
13+
14+ // CHECK-LABEL: func.func @test1() attributes {my_loop_depths = [1]} {
15+ // CHECK-NEXT: %c0 = arith.constant 0 : index
16+ // CHECK-NEXT: %c7 = arith.constant 7 : index
17+ // CHECK-NEXT: %c1 = arith.constant 1 : index
18+ // CHECK-NEXT: scf.for %arg0 = %c0 to %c7 step %c1 {
19+ // CHECK-NEXT: }
20+ // CHECK-NEXT: return
21+ // CHECK-NEXT: }
22+ func.func @test1 () {
23+ %c0 = arith.constant 0 : index
24+ %c7 = arith.constant 7 : index
25+ %c1 = arith.constant 1 : index
26+ scf.for %i = %c0 to %c7 step %c1 {
27+ }
28+ return
29+ }
30+
31+ // CHECK-LABEL: func.func @test2() attributes {my_loop_depths = [2]} {
32+ // CHECK-NEXT: %c0 = arith.constant 0 : index
33+ // CHECK-NEXT: %c7 = arith.constant 7 : index
34+ // CHECK-NEXT: %c1 = arith.constant 1 : index
35+ // CHECK-NEXT: %true = arith.constant true
36+ // CHECK-NEXT: scf.for %arg0 = %c0 to %c7 step %c1 {
37+ // CHECK-NEXT: scf.if %true {
38+ // CHECK-NEXT: }
39+ // CHECK-NEXT: }
40+ // CHECK-NEXT: return
41+ // CHECK-NEXT: }
42+ func.func @test2 () {
43+ %c0 = arith.constant 0 : index
44+ %c7 = arith.constant 7 : index
45+ %c1 = arith.constant 1 : index
46+ %cond = arith.constant true
47+ scf.for %i = %c0 to %c7 step %c1 {
48+ scf.if %cond {
49+ }
50+ }
51+ return
52+ }
53+
54+ // CHECK-LABEL: func.func @test3() attributes {my_loop_depths = [3]} {
55+ // CHECK-NEXT: %c0 = arith.constant 0 : index
56+ // CHECK-NEXT: %c7 = arith.constant 7 : index
57+ // CHECK-NEXT: %c3 = arith.constant 3 : index
58+ // CHECK-NEXT: %true = arith.constant true
59+ // CHECK-NEXT: scf.for %arg0 = %c0 to %c7 step %c3 {
60+ // CHECK-NEXT: scf.if %true {
61+ // CHECK-NEXT: scf.if %true {
62+ // CHECK-NEXT: }
63+ // CHECK-NEXT: }
64+ // CHECK-NEXT: }
65+ // CHECK-NEXT: return
66+ // CHECK-NEXT: }
67+ func.func @test3 () {
68+ %c0 = arith.constant 0 : index
69+ %c7 = arith.constant 7 : index
70+ %c3 = arith.constant 3 : index
71+ %cond = arith.constant true
72+ scf.for %i = %c0 to %c7 step %c3 {
73+ scf.if %cond {
74+ scf.if %cond {
75+ }
76+ }
77+ }
78+ return
79+ }
80+
81+ // CHECK-LABEL: func.func @test4() attributes {my_loop_depths = [2]} {
82+ // CHECK-NEXT: %c0 = arith.constant 0 : index
83+ // CHECK-NEXT: %c20 = arith.constant 20 : index
84+ // CHECK-NEXT: %c7 = arith.constant 7 : index
85+ // CHECK-NEXT: %c1 = arith.constant 1 : index
86+ // CHECK-NEXT: scf.for %arg0 = %c0 to %c20 step %c1 {
87+ // CHECK-NEXT: scf.for %arg1 = %c0 to %c7 step %c1 {
88+ // CHECK-NEXT: }
89+ // CHECK-NEXT: }
90+ // CHECK-NEXT: return
91+ // CHECK-NEXT: }
92+ func.func @test4 () {
93+ %c0 = arith.constant 0 : index
94+ %c20 = arith.constant 20 : index
95+ %c7 = arith.constant 7 : index
96+ %c1 = arith.constant 1 : index
97+ scf.for %i = %c0 to %c20 step %c1 {
98+ scf.for %j = %c0 to %c7 step %c1 {
99+ }
100+ }
101+ return
102+ }
103+
104+ // CHECK-LABEL: func.func @test5() attributes {my_loop_depths = [3]} {
105+ // CHECK-NEXT: %c0 = arith.constant 0 : index
106+ // CHECK-NEXT: %c7 = arith.constant 7 : index
107+ // CHECK-NEXT: %c1 = arith.constant 1 : index
108+ // CHECK-NEXT: %true = arith.constant true
109+ // CHECK-NEXT: scf.if %true {
110+ // CHECK-NEXT: scf.for %arg0 = %c0 to %c7 step %c1 {
111+ // CHECK-NEXT: scf.if %true {
112+ // CHECK-NEXT: }
113+ // CHECK-NEXT: }
114+ // CHECK-NEXT: }
115+ // CHECK-NEXT: return
116+ // CHECK-NEXT: }
117+
118+ func.func @test5 () {
119+ %c0 = arith.constant 0 : index
120+ %c7 = arith.constant 7 : index
121+ %c1 = arith.constant 1 : index
122+ %cond = arith.constant true
123+ scf.if %cond {
124+ scf.for %i = %c0 to %c7 step %c1 {
125+ scf.if %cond {
126+ }
127+ }
128+ }
129+ return
130+ }
131+
132+
133+ // CHECK-LABEL: func.func @test6() attributes {my_loop_depths = [1]} {
134+ // CHECK-NEXT: affine.for %arg0 = 0 to 10 {
135+ // CHECK-NEXT: }
136+ // CHECK-NEXT: return
137+ // CHECK-NEXT: }
138+ func.func @test6 () {
139+ affine.for %i = 0 to 10 {
140+ }
141+ return
142+ }
0 commit comments