[Flang][OpenMP] Handle SECTION construct from within SECTIONS (#77759)
[llvm-project.git] / mlir / utils / tree-sitter-mlir / test / corpus / controlflow.txt
blob89353d36630f7b8002d736b9c54afeb2868412bd
1 ================================================================================
2 Branching written with cf.br, cf.cond_br
3 ================================================================================
4 func.func @simple(i64, i1) -> i64 {
5 ^bb0(%a: i64, %cond: i1): // Code dominated by ^bb0 may refer to %a
6   cf.cond_br %cond, ^bb1, ^bb2
8 ^bb1:
9   cf.br ^bb3(%a: i64)    // Branch passes %a as the argument
11 ^bb2:
12   %b = arith.addi %a, %a : i64
13   cf.br ^bb3(%b: i64)    // Branch passes %b as the argument
15 // ^bb3 receives an argument, named %c, from predecessors
16 // and passes it on to bb4 along with %a. %a is referenced
17 // directly from its defining operation and is not passed through
18 // an argument of ^bb3.
19 ^bb3(%c: i64):
20   cf.br ^bb4(%c, %a : i64, i64)
22 ^bb4(%d : i64, %e : i64):
23   %0 = arith.addi %d, %e : i64
24   return %0 : i64   // Return is also a terminator.
26 --------------------------------------------------------------------------------
28 (toplevel
29   (operation
30     (custom_operation
31       (func_dialect
32         (symbol_ref_id)
33         (func_arg_list
34           (type
35             (builtin_type
36               (integer_type)))
37           (type
38             (builtin_type
39               (integer_type))))
40         (func_return
41           (type_list_attr_parens
42             (type
43               (builtin_type
44                 (integer_type)))))
45         (region
46           (block
47             (block_label
48               (caret_id)
49               (block_arg_list
50                 (value_use)
51                 (type
52                   (builtin_type
53                     (integer_type)))
54                 (value_use)
55                 (type
56                   (builtin_type
57                     (integer_type)))))
58             (comment)
59             (operation
60               (custom_operation
61                 (cf_dialect
62                   (value_use)
63                   (successor
64                     (caret_id))
65                   (successor
66                     (caret_id))))))
67           (block
68             (block_label
69               (caret_id))
70             (operation
71               (custom_operation
72                 (cf_dialect
73                   (successor
74                     (caret_id)
75                     (value_use)
76                     (type
77                       (builtin_type
78                         (integer_type))))))))
79           (comment)
80           (block
81             (block_label
82               (caret_id))
83             (operation
84               (op_result
85                 (value_use))
86               (custom_operation
87                 (arith_dialect
88                   (value_use)
89                   (value_use)
90                   (type
91                     (builtin_type
92                       (integer_type))))))
93             (operation
94               (custom_operation
95                 (cf_dialect
96                   (successor
97                     (caret_id)
98                     (value_use)
99                     (type
100                       (builtin_type
101                         (integer_type))))))))
102           (comment)
103           (comment)
104           (comment)
105           (comment)
106           (comment)
107           (block
108             (block_label
109               (caret_id)
110               (block_arg_list
111                 (value_use)
112                 (type
113                   (builtin_type
114                     (integer_type)))))
115             (operation
116               (custom_operation
117                 (cf_dialect
118                   (successor
119                     (caret_id)
120                     (value_use)
121                     (value_use)
122                     (type
123                       (builtin_type
124                         (integer_type)))
125                     (type
126                       (builtin_type
127                         (integer_type))))))))
128           (block
129             (block_label
130               (caret_id)
131               (block_arg_list
132                 (value_use)
133                 (type
134                   (builtin_type
135                     (integer_type)))
136                 (value_use)
137                 (type
138                   (builtin_type
139                     (integer_type)))))
140             (operation
141               (op_result
142                 (value_use))
143               (custom_operation
144                 (arith_dialect
145                   (value_use)
146                   (value_use)
147                   (type
148                     (builtin_type
149                       (integer_type))))))
150             (operation
151               (custom_operation
152                 (func_dialect
153                   (value_use)
154                   (type
155                     (builtin_type
156                       (integer_type)))))))
157           (comment))))))
159 ================================================================================
160 Switch statement written with cf.switch
161 ================================================================================
162 func.func @switch(%flag : i32, %caseOperand : i32) {
163   cf.switch %flag : i32, [
164     default: ^bb1(%caseOperand : i32),
165     42: ^bb2(%caseOperand : i32),
166     43: ^bb3(%caseOperand : i32)
167   ]
169   ^bb1(%bb1arg : i32):
170     return
171   ^bb2(%bb2arg : i32):
172     return
173   ^bb3(%bb3arg : i32):
174     return
176 --------------------------------------------------------------------------------
178 (toplevel
179   (operation
180     (custom_operation
181       (func_dialect
182         (symbol_ref_id)
183         (func_arg_list
184           (value_use)
185           (type
186             (builtin_type
187               (integer_type)))
188           (value_use)
189           (type
190             (builtin_type
191               (integer_type))))
192         (region
193           (entry_block
194             (operation
195               (custom_operation
196                 (cf_dialect
197                   (value_use)
198                   (type
199                     (builtin_type
200                       (integer_type)))
201                   (cf_case_label)
202                   (successor
203                     (caret_id)
204                     (value_use)
205                     (type
206                       (builtin_type
207                         (integer_type))))
208                   (cf_case_label
209                     (integer_literal))
210                   (successor
211                     (caret_id)
212                     (value_use)
213                     (type
214                       (builtin_type
215                         (integer_type))))
216                   (cf_case_label
217                     (integer_literal))
218                   (successor
219                     (caret_id)
220                     (value_use)
221                     (type
222                       (builtin_type
223                         (integer_type))))))))
224           (block
225             (block_label
226               (caret_id)
227               (block_arg_list
228                 (value_use)
229                 (type
230                   (builtin_type
231                     (integer_type)))))
232             (operation
233               (custom_operation
234                 (func_dialect))))
235           (block
236             (block_label
237               (caret_id)
238               (block_arg_list
239                 (value_use)
240                 (type
241                   (builtin_type
242                     (integer_type)))))
243             (operation
244               (custom_operation
245                 (func_dialect))))
246           (block
247             (block_label
248               (caret_id)
249               (block_arg_list
250                 (value_use)
251                 (type
252                   (builtin_type
253                     (integer_type)))))
254             (operation
255               (custom_operation
256                 (func_dialect)))))))))
258 ================================================================================
259 Simple for-loop written with scf.for
260 ================================================================================
261 func.func @for_loop_with_increasing_arg() -> i1 {
262   %c0 = arith.constant 0 : index
263   %c1 = arith.constant 1 : index
264   %c4 = arith.constant 4 : index
265   %c16 = arith.constant 16 : index
266   %0 = scf.for %arg0 = %c0 to %c4 step %c1 iter_args(%arg1 = %c0) -> index {
267       %10 = arith.addi %arg0, %arg1 : index
268       scf.yield %10 : index
269   }
270   %1 = arith.cmpi ule, %0, %c16 : index
271   func.return %1 : i1
273 --------------------------------------------------------------------------------
275 (toplevel
276   (operation
277     (custom_operation
278       (func_dialect
279         (symbol_ref_id)
280         (func_arg_list)
281         (func_return
282           (type_list_attr_parens
283             (type
284               (builtin_type
285                 (integer_type)))))
286         (region
287           (entry_block
288             (operation
289               (op_result
290                 (value_use))
291               (custom_operation
292                 (arith_dialect
293                   (integer_literal)
294                   (type
295                     (builtin_type
296                       (index_type))))))
297             (operation
298               (op_result
299                 (value_use))
300               (custom_operation
301                 (arith_dialect
302                   (integer_literal)
303                   (type
304                     (builtin_type
305                       (index_type))))))
306             (operation
307               (op_result
308                 (value_use))
309               (custom_operation
310                 (arith_dialect
311                   (integer_literal)
312                   (type
313                     (builtin_type
314                       (index_type))))))
315             (operation
316               (op_result
317                 (value_use))
318               (custom_operation
319                 (arith_dialect
320                   (integer_literal)
321                   (type
322                     (builtin_type
323                       (index_type))))))
324             (operation
325               (op_result
326                 (value_use))
327               (custom_operation
328                 (scf_dialect
329                   (value_use)
330                   (value_use)
331                   (value_use)
332                   (value_use)
333                   (value_use)
334                   (value_use)
335                   (type
336                     (builtin_type
337                       (index_type)))
338                   (region
339                     (entry_block
340                       (operation
341                         (op_result
342                           (value_use))
343                         (custom_operation
344                           (arith_dialect
345                             (value_use)
346                             (value_use)
347                             (type
348                               (builtin_type
349                                 (index_type))))))
350                       (operation
351                         (custom_operation
352                           (scf_dialect
353                             (value_use)
354                             (type
355                               (builtin_type
356                                 (index_type)))))))))))
357             (operation
358               (op_result
359                 (value_use))
360               (custom_operation
361                 (arith_dialect
362                   (value_use)
363                   (value_use)
364                   (type
365                     (builtin_type
366                       (index_type))))))
367             (operation
368               (custom_operation
369                 (func_dialect
370                   (value_use)
371                   (type
372                     (builtin_type
373                       (integer_type))))))))))))
375 ================================================================================
376 Nested for-loop written using scf.for
377 ================================================================================
378 func.func @std_for(%arg0 : index, %arg1 : index, %arg2 : index) {
379   scf.for %i0 = %arg0 to %arg1 step %arg2 {
380     scf.for %i1 = %arg0 to %arg1 step %arg2 {
381       %min_cmp = arith.cmpi slt, %i0, %i1 : index
382       %min = arith.select %min_cmp, %i0, %i1 : index
383       %max_cmp = arith.cmpi sge, %i0, %i1 : index
384       %max = arith.select %max_cmp, %i0, %i1 : index
385       scf.for %i2 = %min to %max step %i1 {
386       }
387     }
388   }
389   return
391 --------------------------------------------------------------------------------
393 (toplevel
394   (operation
395     (custom_operation
396       (func_dialect
397         (symbol_ref_id)
398         (func_arg_list
399           (value_use)
400           (type
401             (builtin_type
402               (index_type)))
403           (value_use)
404           (type
405             (builtin_type
406               (index_type)))
407           (value_use)
408           (type
409             (builtin_type
410               (index_type))))
411         (region
412           (entry_block
413             (operation
414               (custom_operation
415                 (scf_dialect
416                   (value_use)
417                   (value_use)
418                   (value_use)
419                   (value_use)
420                   (region
421                     (entry_block
422                       (operation
423                         (custom_operation
424                           (scf_dialect
425                             (value_use)
426                             (value_use)
427                             (value_use)
428                             (value_use)
429                             (region
430                               (entry_block
431                                 (operation
432                                   (op_result
433                                     (value_use))
434                                   (custom_operation
435                                     (arith_dialect
436                                       (value_use)
437                                       (value_use)
438                                       (type
439                                         (builtin_type
440                                           (index_type))))))
441                                 (operation
442                                   (op_result
443                                     (value_use))
444                                   (custom_operation
445                                     (arith_dialect
446                                       (value_use)
447                                       (value_use)
448                                       (value_use)
449                                       (type
450                                         (builtin_type
451                                           (index_type))))))
452                                 (operation
453                                   (op_result
454                                     (value_use))
455                                   (custom_operation
456                                     (arith_dialect
457                                       (value_use)
458                                       (value_use)
459                                       (type
460                                         (builtin_type
461                                           (index_type))))))
462                                 (operation
463                                   (op_result
464                                     (value_use))
465                                   (custom_operation
466                                     (arith_dialect
467                                       (value_use)
468                                       (value_use)
469                                       (value_use)
470                                       (type
471                                         (builtin_type
472                                           (index_type))))))
473                                 (operation
474                                   (custom_operation
475                                     (scf_dialect
476                                       (value_use)
477                                       (value_use)
478                                       (value_use)
479                                       (value_use)
480                                       (region))))))))))))))
481             (operation
482               (custom_operation
483                 (func_dialect)))))))))
485 ================================================================================
486 Conditional written with scf.if and scf.yield
487 ================================================================================
488 func.func @std_if_yield(%arg0: i1, %arg1: f32)
490   %x, %y = scf.if %arg0 -> (f32, f32) {
491     %0 = arith.addf %arg1, %arg1 : f32
492     %1 = arith.subf %arg1, %arg1 : f32
493     scf.yield %0, %1 : f32, f32
494   } else {
495     %0 = arith.subf %arg1, %arg1 : f32
496     %1 = arith.addf %arg1, %arg1 : f32
497     scf.yield %0, %1 : f32, f32
498   }
499   return
501 --------------------------------------------------------------------------------
503 (toplevel
504   (operation
505     (custom_operation
506       (func_dialect
507         (symbol_ref_id)
508         (func_arg_list
509           (value_use)
510           (type
511             (builtin_type
512               (integer_type)))
513           (value_use)
514           (type
515             (builtin_type
516               (float_type))))
517         (region
518           (entry_block
519             (operation
520               (op_result
521                 (value_use))
522               (op_result
523                 (value_use))
524               (custom_operation
525                 (scf_dialect
526                   (value_use)
527                   (type
528                     (builtin_type
529                       (float_type)))
530                   (type
531                     (builtin_type
532                       (float_type)))
533                   (region
534                     (entry_block
535                       (operation
536                         (op_result
537                           (value_use))
538                         (custom_operation
539                           (arith_dialect
540                             (value_use)
541                             (value_use)
542                             (type
543                               (builtin_type
544                                 (float_type))))))
545                       (operation
546                         (op_result
547                           (value_use))
548                         (custom_operation
549                           (arith_dialect
550                             (value_use)
551                             (value_use)
552                             (type
553                               (builtin_type
554                                 (float_type))))))
555                       (operation
556                         (custom_operation
557                           (scf_dialect
558                             (value_use)
559                             (value_use)
560                             (type
561                               (builtin_type
562                                 (float_type)))
563                             (type
564                               (builtin_type
565                                 (float_type))))))))
566                   (region
567                     (entry_block
568                       (operation
569                         (op_result
570                           (value_use))
571                         (custom_operation
572                           (arith_dialect
573                             (value_use)
574                             (value_use)
575                             (type
576                               (builtin_type
577                                 (float_type))))))
578                       (operation
579                         (op_result
580                           (value_use))
581                         (custom_operation
582                           (arith_dialect
583                             (value_use)
584                             (value_use)
585                             (type
586                               (builtin_type
587                                 (float_type))))))
588                       (operation
589                         (custom_operation
590                           (scf_dialect
591                             (value_use)
592                             (value_use)
593                             (type
594                               (builtin_type
595                                 (float_type)))
596                             (type
597                               (builtin_type
598                                 (float_type)))))))))))
599             (operation
600               (custom_operation
601                 (func_dialect)))))))))
603 ================================================================================
604 Switch statement using scf.index_switch
605 ================================================================================
606 func.func @switch(%arg0: index) -> i32 {
607   %0 = scf.index_switch %arg0 -> i32
608   case 2 {
609     %c10_i32 = arith.constant 10 : i32
610     scf.yield %c10_i32 : i32
611   }
612   case 5 {
613     %c20_i32 = arith.constant 20 : i32
614     scf.yield %c20_i32 : i32
615   }
616   default {
617     %c30_i32 = arith.constant 30 : i32
618     scf.yield %c30_i32 : i32
619   }
621   scf.index_switch %arg0
622   default {
623     scf.yield
624   }
626   return %0 : i32
628 --------------------------------------------------------------------------------
630 (toplevel
631   (operation
632     (custom_operation
633       (func_dialect
634         (symbol_ref_id)
635         (func_arg_list
636           (value_use)
637           (type
638             (builtin_type
639               (index_type))))
640         (func_return
641           (type_list_attr_parens
642             (type
643               (builtin_type
644                 (integer_type)))))
645         (region
646           (entry_block
647             (operation
648               (op_result
649                 (value_use))
650               (custom_operation
651                 (scf_dialect
652                   (value_use)
653                   (type
654                     (builtin_type
655                       (integer_type)))
656                   (scf_case_label
657                     (integer_literal))
658                   (region
659                     (entry_block
660                       (operation
661                         (op_result
662                           (value_use))
663                         (custom_operation
664                           (arith_dialect
665                             (integer_literal)
666                             (type
667                               (builtin_type
668                                 (integer_type))))))
669                       (operation
670                         (custom_operation
671                           (scf_dialect
672                             (value_use)
673                             (type
674                               (builtin_type
675                                 (integer_type))))))))
676                   (scf_case_label
677                     (integer_literal))
678                   (region
679                     (entry_block
680                       (operation
681                         (op_result
682                           (value_use))
683                         (custom_operation
684                           (arith_dialect
685                             (integer_literal)
686                             (type
687                               (builtin_type
688                                 (integer_type))))))
689                       (operation
690                         (custom_operation
691                           (scf_dialect
692                             (value_use)
693                             (type
694                               (builtin_type
695                                 (integer_type))))))))
696                   (scf_case_label)
697                   (region
698                     (entry_block
699                       (operation
700                         (op_result
701                           (value_use))
702                         (custom_operation
703                           (arith_dialect
704                             (integer_literal)
705                             (type
706                               (builtin_type
707                                 (integer_type))))))
708                       (operation
709                         (custom_operation
710                           (scf_dialect
711                             (value_use)
712                             (type
713                               (builtin_type
714                                 (integer_type)))))))))))
715             (operation
716               (custom_operation
717                 (scf_dialect
718                   (value_use)
719                   (scf_case_label)
720                   (region
721                     (entry_block
722                       (operation
723                         (custom_operation
724                           (scf_dialect))))))))
725             (operation
726               (custom_operation
727                 (func_dialect
728                   (value_use)
729                   (type
730                     (builtin_type
731                       (integer_type))))))))))))
733 ================================================================================
734 Parallel for-loop and reduction using scf.parallel and scf.reduce
735 ================================================================================
736 func.func @single_iteration_reduce(%A: index, %B: index) -> (index, index) {
737   %c0 = arith.constant 0 : index
738   %c1 = arith.constant 1 : index
739   %c2 = arith.constant 2 : index
740   %c3 = arith.constant 3 : index
741   %c6 = arith.constant 6 : index
742   %0:2 = scf.parallel (%i0, %i1) = (%c1, %c3) to (%c2, %c6) step (%c1, %c3) init(%A, %B) -> (index, index) {
743     scf.reduce(%i0) : index {
744     ^bb0(%lhs: index, %rhs: index):
745       %1 = arith.addi %lhs, %rhs : index
746       scf.reduce.return %1 : index
747     }
748     scf.reduce(%i1) : index {
749     ^bb0(%lhs: index, %rhs: index):
750       %2 = arith.muli %lhs, %rhs : index
751       scf.reduce.return %2 : index
752     }
753     scf.yield
754   }
755   return %0#0, %0#1 : index, index
758 func.func @single_iteration_some(%A: memref<?x?x?xi32>) {
759   %c0 = arith.constant 0 : index
760   %c1 = arith.constant 1 : index
761   %c2 = arith.constant 2 : index
762   %c3 = arith.constant 3 : index
763   %c6 = arith.constant 6 : index
764   %c7 = arith.constant 7 : index
765   %c10 = arith.constant 10 : index
766   scf.parallel (%i0, %i1, %i2) = (%c0, %c3, %c7) to (%c1, %c6, %c10) step (%c1, %c2, %c3) {
767     %c42 = arith.constant 42 : i32
768     memref.store %c42, %A[%i0, %i1, %i2] : memref<?x?x?xi32>
769     scf.yield
770   }
771   return
773 --------------------------------------------------------------------------------
775 (toplevel
776   (operation
777     (custom_operation
778       (func_dialect
779         (symbol_ref_id)
780         (func_arg_list
781           (value_use)
782           (type
783             (builtin_type
784               (index_type)))
785           (value_use)
786           (type
787             (builtin_type
788               (index_type))))
789         (func_return
790           (type_list_attr_parens
791             (type
792               (builtin_type
793                 (index_type)))
794             (type
795               (builtin_type
796                 (index_type)))))
797         (region
798           (entry_block
799             (operation
800               (op_result
801                 (value_use))
802               (custom_operation
803                 (arith_dialect
804                   (integer_literal)
805                   (type
806                     (builtin_type
807                       (index_type))))))
808             (operation
809               (op_result
810                 (value_use))
811               (custom_operation
812                 (arith_dialect
813                   (integer_literal)
814                   (type
815                     (builtin_type
816                       (index_type))))))
817             (operation
818               (op_result
819                 (value_use))
820               (custom_operation
821                 (arith_dialect
822                   (integer_literal)
823                   (type
824                     (builtin_type
825                       (index_type))))))
826             (operation
827               (op_result
828                 (value_use))
829               (custom_operation
830                 (arith_dialect
831                   (integer_literal)
832                   (type
833                     (builtin_type
834                       (index_type))))))
835             (operation
836               (op_result
837                 (value_use))
838               (custom_operation
839                 (arith_dialect
840                   (integer_literal)
841                   (type
842                     (builtin_type
843                       (index_type))))))
844             (operation
845               (op_result
846                 (value_use))
847               (custom_operation
848                 (scf_dialect
849                   (value_use)
850                   (value_use)
851                   (value_use)
852                   (value_use)
853                   (value_use)
854                   (value_use)
855                   (value_use)
856                   (value_use)
857                   (value_use)
858                   (value_use)
859                   (type
860                     (builtin_type
861                       (index_type)))
862                   (type
863                     (builtin_type
864                       (index_type)))
865                   (region
866                     (entry_block
867                       (operation
868                         (custom_operation
869                           (scf_dialect
870                             (value_use)
871                             (type
872                               (builtin_type
873                                 (index_type)))
874                             (region
875                               (block
876                                 (block_label
877                                   (caret_id)
878                                   (block_arg_list
879                                     (value_use)
880                                     (type
881                                       (builtin_type
882                                         (index_type)))
883                                     (value_use)
884                                     (type
885                                       (builtin_type
886                                         (index_type)))))
887                                 (operation
888                                   (op_result
889                                     (value_use))
890                                   (custom_operation
891                                     (arith_dialect
892                                       (value_use)
893                                       (value_use)
894                                       (type
895                                         (builtin_type
896                                           (index_type))))))
897                                 (operation
898                                   (custom_operation
899                                     (scf_dialect
900                                       (value_use)
901                                       (type
902                                         (builtin_type
903                                           (index_type)))))))))))
904                       (operation
905                         (custom_operation
906                           (scf_dialect
907                             (value_use)
908                             (type
909                               (builtin_type
910                                 (index_type)))
911                             (region
912                               (block
913                                 (block_label
914                                   (caret_id)
915                                   (block_arg_list
916                                     (value_use)
917                                     (type
918                                       (builtin_type
919                                         (index_type)))
920                                     (value_use)
921                                     (type
922                                       (builtin_type
923                                         (index_type)))))
924                                 (operation
925                                   (op_result
926                                     (value_use))
927                                   (custom_operation
928                                     (arith_dialect
929                                       (value_use)
930                                       (value_use)
931                                       (type
932                                         (builtin_type
933                                           (index_type))))))
934                                 (operation
935                                   (custom_operation
936                                     (scf_dialect
937                                       (value_use)
938                                       (type
939                                         (builtin_type
940                                           (index_type)))))))))))
941                       (operation
942                         (custom_operation
943                           (scf_dialect))))))))
944             (operation
945               (custom_operation
946                 (func_dialect
947                   (value_use)
948                   (value_use)
949                   (type
950                     (builtin_type
951                       (index_type)))
952                   (type
953                     (builtin_type
954                       (index_type)))))))))))
955   (operation
956     (custom_operation
957       (func_dialect
958         (symbol_ref_id)
959         (func_arg_list
960           (value_use)
961           (type
962             (builtin_type
963               (memref_type
964                 (dim_list
965                   (integer_type))))))
966         (region
967           (entry_block
968             (operation
969               (op_result
970                 (value_use))
971               (custom_operation
972                 (arith_dialect
973                   (integer_literal)
974                   (type
975                     (builtin_type
976                       (index_type))))))
977             (operation
978               (op_result
979                 (value_use))
980               (custom_operation
981                 (arith_dialect
982                   (integer_literal)
983                   (type
984                     (builtin_type
985                       (index_type))))))
986             (operation
987               (op_result
988                 (value_use))
989               (custom_operation
990                 (arith_dialect
991                   (integer_literal)
992                   (type
993                     (builtin_type
994                       (index_type))))))
995             (operation
996               (op_result
997                 (value_use))
998               (custom_operation
999                 (arith_dialect
1000                   (integer_literal)
1001                   (type
1002                     (builtin_type
1003                       (index_type))))))
1004             (operation
1005               (op_result
1006                 (value_use))
1007               (custom_operation
1008                 (arith_dialect
1009                   (integer_literal)
1010                   (type
1011                     (builtin_type
1012                       (index_type))))))
1013             (operation
1014               (op_result
1015                 (value_use))
1016               (custom_operation
1017                 (arith_dialect
1018                   (integer_literal)
1019                   (type
1020                     (builtin_type
1021                       (index_type))))))
1022             (operation
1023               (op_result
1024                 (value_use))
1025               (custom_operation
1026                 (arith_dialect
1027                   (integer_literal)
1028                   (type
1029                     (builtin_type
1030                       (index_type))))))
1031             (operation
1032               (custom_operation
1033                 (scf_dialect
1034                   (value_use)
1035                   (value_use)
1036                   (value_use)
1037                   (value_use)
1038                   (value_use)
1039                   (value_use)
1040                   (value_use)
1041                   (value_use)
1042                   (value_use)
1043                   (value_use)
1044                   (value_use)
1045                   (value_use)
1046                   (region
1047                     (entry_block
1048                       (operation
1049                         (op_result
1050                           (value_use))
1051                         (custom_operation
1052                           (arith_dialect
1053                             (integer_literal)
1054                             (type
1055                               (builtin_type
1056                                 (integer_type))))))
1057                       (operation
1058                         (custom_operation
1059                           (memref_dialect
1060                             (value_use)
1061                             (value_use)
1062                             (value_use)
1063                             (value_use)
1064                             (value_use)
1065                             (type
1066                               (builtin_type
1067                                 (memref_type
1068                                   (dim_list
1069                                     (integer_type))))))))
1070                       (operation
1071                         (custom_operation
1072                           (scf_dialect))))))))
1073             (operation
1074               (custom_operation
1075                 (func_dialect)))))))))
1077 ================================================================================
1078 While loop written using scf.while and scf.condition
1079 ================================================================================
1080 func.func @while_cond_true() -> i1 {
1081   %0 = scf.while () : () -> i1 {
1082     %condition = "test.condition"() : () -> i1
1083     scf.condition(%condition) %condition : i1
1084   } do {
1085   ^bb0(%arg0: i1):
1086     "test.use"(%arg0) : (i1) -> ()
1087     scf.yield
1088   }
1089   return %0 : i1
1092 func.func @while_unused_arg(%x : i32, %y : f64) -> i32 {
1093   %0 = scf.while (%arg1 = %x, %arg2 = %y) : (i32, f64) -> (i32) {
1094     %condition = "test.condition"(%arg1) : (i32) -> i1
1095     scf.condition(%condition) %arg1 : i32
1096   } do {
1097   ^bb0(%arg1: i32):
1098     %next = "test.use"(%arg1) : (i32) -> (i32)
1099     scf.yield %next, %y : i32, f64
1100   }
1101   return %0 : i32
1104 func.func @infinite_while() {
1105   %true = arith.constant true
1106   scf.while : () -> () {
1107     scf.condition(%true)
1108   } do {
1109     scf.yield
1110   }
1111   return
1113 --------------------------------------------------------------------------------
1115 (toplevel
1116   (operation
1117     (custom_operation
1118       (func_dialect
1119         (symbol_ref_id)
1120         (func_arg_list)
1121         (func_return
1122           (type_list_attr_parens
1123             (type
1124               (builtin_type
1125                 (integer_type)))))
1126         (region
1127           (entry_block
1128             (operation
1129               (op_result
1130                 (value_use))
1131               (custom_operation
1132                 (scf_dialect
1133                   (function_type
1134                     (type
1135                       (builtin_type
1136                         (integer_type))))
1137                   (region
1138                     (entry_block
1139                       (operation
1140                         (op_result
1141                           (value_use))
1142                         (generic_operation
1143                           (string_literal)
1144                           (function_type
1145                             (type
1146                               (builtin_type
1147                                 (integer_type))))))
1148                       (operation
1149                         (custom_operation
1150                           (scf_dialect
1151                             (value_use)
1152                             (value_use)
1153                             (type
1154                               (builtin_type
1155                                 (integer_type))))))))
1156                   (region
1157                     (block
1158                       (block_label
1159                         (caret_id)
1160                         (block_arg_list
1161                           (value_use)
1162                           (type
1163                             (builtin_type
1164                               (integer_type)))))
1165                       (operation
1166                         (generic_operation
1167                           (string_literal)
1168                           (value_use)
1169                           (function_type
1170                             (type
1171                               (builtin_type
1172                                 (integer_type))))))
1173                       (operation
1174                         (custom_operation
1175                           (scf_dialect))))))))
1176             (operation
1177               (custom_operation
1178                 (func_dialect
1179                   (value_use)
1180                   (type
1181                     (builtin_type
1182                       (integer_type)))))))))))
1183   (operation
1184     (custom_operation
1185       (func_dialect
1186         (symbol_ref_id)
1187         (func_arg_list
1188           (value_use)
1189           (type
1190             (builtin_type
1191               (integer_type)))
1192           (value_use)
1193           (type
1194             (builtin_type
1195               (float_type))))
1196         (func_return
1197           (type_list_attr_parens
1198             (type
1199               (builtin_type
1200                 (integer_type)))))
1201         (region
1202           (entry_block
1203             (operation
1204               (op_result
1205                 (value_use))
1206               (custom_operation
1207                 (scf_dialect
1208                   (value_use)
1209                   (value_use)
1210                   (value_use)
1211                   (value_use)
1212                   (function_type
1213                     (type
1214                       (builtin_type
1215                         (integer_type)))
1216                     (type
1217                       (builtin_type
1218                         (float_type)))
1219                     (type
1220                       (builtin_type
1221                         (integer_type))))
1222                   (region
1223                     (entry_block
1224                       (operation
1225                         (op_result
1226                           (value_use))
1227                         (generic_operation
1228                           (string_literal)
1229                           (value_use)
1230                           (function_type
1231                             (type
1232                               (builtin_type
1233                                 (integer_type)))
1234                             (type
1235                               (builtin_type
1236                                 (integer_type))))))
1237                       (operation
1238                         (custom_operation
1239                           (scf_dialect
1240                             (value_use)
1241                             (value_use)
1242                             (type
1243                               (builtin_type
1244                                 (integer_type))))))))
1245                   (region
1246                     (block
1247                       (block_label
1248                         (caret_id)
1249                         (block_arg_list
1250                           (value_use)
1251                           (type
1252                             (builtin_type
1253                               (integer_type)))))
1254                       (operation
1255                         (op_result
1256                           (value_use))
1257                         (generic_operation
1258                           (string_literal)
1259                           (value_use)
1260                           (function_type
1261                             (type
1262                               (builtin_type
1263                                 (integer_type)))
1264                             (type
1265                               (builtin_type
1266                                 (integer_type))))))
1267                       (operation
1268                         (custom_operation
1269                           (scf_dialect
1270                             (value_use)
1271                             (value_use)
1272                             (type
1273                               (builtin_type
1274                                 (integer_type)))
1275                             (type
1276                               (builtin_type
1277                                 (float_type)))))))))))
1278             (operation
1279               (custom_operation
1280                 (func_dialect
1281                   (value_use)
1282                   (type
1283                     (builtin_type
1284                       (integer_type)))))))))))
1285   (operation
1286     (custom_operation
1287       (func_dialect
1288         (symbol_ref_id)
1289         (func_arg_list)
1290         (region
1291           (entry_block
1292             (operation
1293               (op_result
1294                 (value_use))
1295               (custom_operation
1296                 (arith_dialect
1297                   (bool_literal))))
1298             (operation
1299               (custom_operation
1300                 (scf_dialect
1301                   (function_type)
1302                   (region
1303                     (entry_block
1304                       (operation
1305                         (custom_operation
1306                           (scf_dialect
1307                             (value_use))))))
1308                   (region
1309                     (entry_block
1310                       (operation
1311                         (custom_operation
1312                           (scf_dialect))))))))
1313             (operation
1314               (custom_operation
1315                 (func_dialect)))))))))
1317 ================================================================================
1318 affine.for with attribute aliseses
1319 ================================================================================
1320 #map_simple0 = affine_map<()[] -> (10)>
1321 #map_simple1 = affine_map<()[s0] -> (s0)>
1322 #map_non_simple0 = affine_map<(d0)[] -> (d0)>
1323 #map_non_simple1 = affine_map<(d0)[s0] -> (d0 + s0)>
1324 #map_non_simple2 = affine_map<()[s0, s1] -> (s0 + s1)>
1325 #map_non_simple3 = affine_map<()[s0] -> (s0 + 3)>
1326 func.func @funcsimplemap(%arg0: index, %arg1: index) -> () {
1327   affine.for %i0 = 0 to #map_simple0()[] {
1328     affine.for %i1 = 0 to #map_simple1()[%arg1] {
1329       affine.for %i2 = 0 to #map_non_simple0(%i0)[] {
1330         affine.for %i3 = 0 to #map_non_simple1(%i0)[%arg1] {
1331           affine.for %i4 = 0 to #map_non_simple2()[%arg1, %arg0] {
1332             affine.for %i5 = 0 to #map_non_simple3()[%arg0] {
1333               %c42_i32 = arith.constant 42 : i32
1334             }
1335           }
1336         }
1337       }
1338     }
1339   }
1340   return
1342 --------------------------------------------------------------------------------
1344 (toplevel
1345   (attribute_alias_def
1346     (attribute_value
1347       (builtin_attribute
1348         (affine_map
1349           (integer_literal)))))
1350   (attribute_alias_def
1351     (attribute_value
1352       (builtin_attribute
1353         (affine_map
1354           (bare_id)
1355           (bare_id)))))
1356   (attribute_alias_def
1357     (attribute_value
1358       (builtin_attribute
1359         (affine_map
1360           (bare_id)
1361           (bare_id)))))
1362   (attribute_alias_def
1363     (attribute_value
1364       (builtin_attribute
1365         (affine_map
1366           (bare_id)
1367           (bare_id)
1368           (bare_id)
1369           (bare_id)))))
1370   (attribute_alias_def
1371     (attribute_value
1372       (builtin_attribute
1373         (affine_map
1374           (bare_id)
1375           (bare_id)
1376           (bare_id)
1377           (bare_id)))))
1378   (attribute_alias_def
1379     (attribute_value
1380       (builtin_attribute
1381         (affine_map
1382           (bare_id)
1383           (bare_id)
1384           (integer_literal)))))
1385   (operation
1386     (custom_operation
1387       (func_dialect
1388         (symbol_ref_id)
1389         (func_arg_list
1390           (value_use)
1391           (type
1392             (builtin_type
1393               (index_type)))
1394           (value_use)
1395           (type
1396             (builtin_type
1397               (index_type))))
1398         (func_return
1399           (type_list_attr_parens))
1400         (region
1401           (entry_block
1402             (operation
1403               (custom_operation
1404                 (affine_dialect
1405                   (value_use)
1406                   (integer_literal)
1407                   (attribute
1408                     (attribute_alias))
1409                   (region
1410                     (entry_block
1411                       (operation
1412                         (custom_operation
1413                           (affine_dialect
1414                             (value_use)
1415                             (integer_literal)
1416                             (attribute
1417                               (attribute_alias))
1418                             (value_use)
1419                             (region
1420                               (entry_block
1421                                 (operation
1422                                   (custom_operation
1423                                     (affine_dialect
1424                                       (value_use)
1425                                       (integer_literal)
1426                                       (attribute
1427                                         (attribute_alias))
1428                                       (value_use)
1429                                       (region
1430                                         (entry_block
1431                                           (operation
1432                                             (custom_operation
1433                                               (affine_dialect
1434                                                 (value_use)
1435                                                 (integer_literal)
1436                                                 (attribute
1437                                                   (attribute_alias))
1438                                                 (value_use)
1439                                                 (value_use)
1440                                                 (region
1441                                                   (entry_block
1442                                                     (operation
1443                                                       (custom_operation
1444                                                         (affine_dialect
1445                                                           (value_use)
1446                                                           (integer_literal)
1447                                                           (attribute
1448                                                             (attribute_alias))
1449                                                           (value_use)
1450                                                           (value_use)
1451                                                           (region
1452                                                             (entry_block
1453                                                               (operation
1454                                                                 (custom_operation
1455                                                                   (affine_dialect
1456                                                                     (value_use)
1457                                                                     (integer_literal)
1458                                                                     (attribute
1459                                                                       (attribute_alias))
1460                                                                     (value_use)
1461                                                                     (region
1462                                                                       (entry_block
1463                                                                         (operation
1464                                                                           (op_result
1465                                                                             (value_use))
1466                                                                           (custom_operation
1467                                                                             (arith_dialect
1468                                                                               (integer_literal)
1469                                                                               (type
1470                                                                                 (builtin_type
1471                                                                                   (integer_type))))))))))))))))))))))))))))))))))))
1472             (operation
1473               (custom_operation
1474                 (func_dialect)))))))))
1476 ================================================================================
1477 affine.if and affine.yield
1478 ================================================================================
1479 func.func @affine_if() -> f32 {
1480   %zero = arith.constant 0.0 : f32
1481   %0 = affine.if affine_set<() : ()> () -> f32 {
1482     affine.yield %zero : f32
1483   } else {
1484     affine.yield %zero : f32
1485   }
1486   return %0 : f32
1488 --------------------------------------------------------------------------------
1490 (toplevel
1491   (operation
1492     (custom_operation
1493       (func_dialect
1494         (symbol_ref_id)
1495         (func_arg_list)
1496         (func_return
1497           (type_list_attr_parens
1498             (type
1499               (builtin_type
1500                 (float_type)))))
1501         (region
1502           (entry_block
1503             (operation
1504               (op_result
1505                 (value_use))
1506               (custom_operation
1507                 (arith_dialect
1508                   (float_literal)
1509                   (type
1510                     (builtin_type
1511                       (float_type))))))
1512             (operation
1513               (op_result
1514                 (value_use))
1515               (custom_operation
1516                 (affine_dialect
1517                   (attribute
1518                     (builtin_attribute
1519                       (affine_set)))
1520                   (type
1521                     (builtin_type
1522                       (float_type)))
1523                   (region
1524                     (entry_block
1525                       (operation
1526                         (custom_operation
1527                           (affine_dialect
1528                             (value_use)
1529                             (type
1530                               (builtin_type
1531                                 (float_type))))))))
1532                   (region
1533                     (entry_block
1534                       (operation
1535                         (custom_operation
1536                           (affine_dialect
1537                             (value_use)
1538                             (type
1539                               (builtin_type
1540                                 (float_type)))))))))))
1541             (operation
1542               (custom_operation
1543                 (func_dialect
1544                   (value_use)
1545                   (type
1546                     (builtin_type
1547                       (float_type))))))))))))
1549 ================================================================================
1550 Parallel for loop written using affine.parallel
1551 ================================================================================
1552 func.func @parallel(%A : memref<100x100xf32>, %N : index) {
1553   affine.parallel (%i0, %j0) = (0, 0) to (symbol(%N), 100) step (10, 10) {
1554     %0:2 = affine.parallel (%i1, %j1) = (%i0, %j0) to (%i0 + 10, %j0 + 10)
1555       reduce ("minf", "maxf") -> (f32, f32) {
1556       %2 = affine.load %A[%i0 + %i0, %j0 + %j1] : memref<100x100xf32>
1557       affine.yield %2, %2 : f32, f32
1558     }
1559   }
1560   return
1563 func.func @parallel_min_max(%a: index, %b: index, %c: index, %d: index) {
1564   affine.parallel (%i, %j, %k) = (max(%a, %b), %b, max(%a, %c))
1565                               to (%c, min(%c, %d), %b) {
1566     affine.yield
1567   }
1568   return
1570 --------------------------------------------------------------------------------
1572 (toplevel
1573   (operation
1574     (custom_operation
1575       (func_dialect
1576         (symbol_ref_id)
1577         (func_arg_list
1578           (value_use)
1579           (type
1580             (builtin_type
1581               (memref_type
1582                 (dim_list
1583                   (float_type)))))
1584           (value_use)
1585           (type
1586             (builtin_type
1587               (index_type))))
1588         (region
1589           (entry_block
1590             (operation
1591               (custom_operation
1592                 (affine_dialect
1593                   (value_use)
1594                   (value_use)
1595                   (integer_literal)
1596                   (integer_literal)
1597                   (value_use)
1598                   (integer_literal)
1599                   (integer_literal)
1600                   (integer_literal)
1601                   (region
1602                     (entry_block
1603                       (operation
1604                         (op_result
1605                           (value_use))
1606                         (custom_operation
1607                           (affine_dialect
1608                             (value_use)
1609                             (value_use)
1610                             (value_use)
1611                             (value_use)
1612                             (value_use)
1613                             (integer_literal)
1614                             (value_use)
1615                             (integer_literal)
1616                             (string_literal)
1617                             (string_literal)
1618                             (type
1619                               (builtin_type
1620                                 (float_type)))
1621                             (type
1622                               (builtin_type
1623                                 (float_type)))
1624                             (region
1625                               (entry_block
1626                                 (operation
1627                                   (op_result
1628                                     (value_use))
1629                                   (custom_operation
1630                                     (affine_dialect
1631                                       (value_use)
1632                                       (value_use)
1633                                       (value_use)
1634                                       (value_use)
1635                                       (value_use)
1636                                       (type
1637                                         (builtin_type
1638                                           (memref_type
1639                                             (dim_list
1640                                               (float_type))))))))
1641                                 (operation
1642                                   (custom_operation
1643                                     (affine_dialect
1644                                       (value_use)
1645                                       (value_use)
1646                                       (type
1647                                         (builtin_type
1648                                           (float_type)))
1649                                       (type
1650                                         (builtin_type
1651                                           (float_type))))))))))))))))
1652             (operation
1653               (custom_operation
1654                 (func_dialect))))))))
1655   (operation
1656     (custom_operation
1657       (func_dialect
1658         (symbol_ref_id)
1659         (func_arg_list
1660           (value_use)
1661           (type
1662             (builtin_type
1663               (index_type)))
1664           (value_use)
1665           (type
1666             (builtin_type
1667               (index_type)))
1668           (value_use)
1669           (type
1670             (builtin_type
1671               (index_type)))
1672           (value_use)
1673           (type
1674             (builtin_type
1675               (index_type))))
1676         (region
1677           (entry_block
1678             (operation
1679               (custom_operation
1680                 (affine_dialect
1681                   (value_use)
1682                   (value_use)
1683                   (value_use)
1684                   (value_use)
1685                   (value_use)
1686                   (value_use)
1687                   (value_use)
1688                   (value_use)
1689                   (value_use)
1690                   (value_use)
1691                   (value_use)
1692                   (value_use)
1693                   (region
1694                     (entry_block
1695                       (operation
1696                         (custom_operation
1697                           (affine_dialect))))))))
1698             (operation
1699               (custom_operation
1700                 (func_dialect)))))))))
1702 ================================================================================
1703 Execution of a region using scf.execute_region
1704 ================================================================================
1705 func.func @execute_region() -> i64 {
1706   %res = scf.execute_region -> i64 {
1707     %c1 = arith.constant 1 : i64
1708     scf.yield %c1 : i64
1709   }
1711   %res2:2 = scf.execute_region -> (i64, i64) {
1712     %c1 = arith.constant 1 : i64
1713     scf.yield %c1, %c1 : i64, i64
1714   }
1715   return %res : i64
1717 --------------------------------------------------------------------------------
1719 (toplevel
1720   (operation
1721     (custom_operation
1722       (func_dialect
1723         (symbol_ref_id)
1724         (func_arg_list)
1725         (func_return
1726           (type_list_attr_parens
1727             (type
1728               (builtin_type
1729                 (integer_type)))))
1730         (region
1731           (entry_block
1732             (operation
1733               (op_result
1734                 (value_use))
1735               (custom_operation
1736                 (scf_dialect
1737                   (type
1738                     (builtin_type
1739                       (integer_type)))
1740                   (region
1741                     (entry_block
1742                       (operation
1743                         (op_result
1744                           (value_use))
1745                         (custom_operation
1746                           (arith_dialect
1747                             (integer_literal)
1748                             (type
1749                               (builtin_type
1750                                 (integer_type))))))
1751                       (operation
1752                         (custom_operation
1753                           (scf_dialect
1754                             (value_use)
1755                             (type
1756                               (builtin_type
1757                                 (integer_type)))))))))))
1758             (operation
1759               (op_result
1760                 (value_use))
1761               (custom_operation
1762                 (scf_dialect
1763                   (type
1764                     (builtin_type
1765                       (integer_type)))
1766                   (type
1767                     (builtin_type
1768                       (integer_type)))
1769                   (region
1770                     (entry_block
1771                       (operation
1772                         (op_result
1773                           (value_use))
1774                         (custom_operation
1775                           (arith_dialect
1776                             (integer_literal)
1777                             (type
1778                               (builtin_type
1779                                 (integer_type))))))
1780                       (operation
1781                         (custom_operation
1782                           (scf_dialect
1783                             (value_use)
1784                             (value_use)
1785                             (type
1786                               (builtin_type
1787                                 (integer_type)))
1788                             (type
1789                               (builtin_type
1790                                 (integer_type)))))))))))
1791             (operation
1792               (custom_operation
1793                 (func_dialect
1794                   (value_use)
1795                   (type
1796                     (builtin_type
1797                       (integer_type))))))))))))
1799 ================================================================================
1800 Parallel loop written using scf.forall and scf.forall.in_parallel
1801 ================================================================================
1802 func.func @normalized_forall(%in: tensor<100xf32>, %out: tensor<100xf32>) {
1803   %c1 = arith.constant 1 : index
1804   %num_threads = arith.constant 100 : index
1805   %result = scf.forall (%thread_idx) in (%num_threads) shared_outs(%o = %out) -> tensor<100xf32> {
1806       %1 = tensor.extract_slice %in[%thread_idx][1][1] : tensor<100xf32> to tensor<1xf32>
1807       scf.forall.in_parallel {
1808         tensor.parallel_insert_slice %1 into %o[%thread_idx][1][1] :
1809           tensor<1xf32> into tensor<100xf32>
1810       }
1811   }
1812   return
1815 func.func @explicit_loop_bounds_forall(%in: tensor<100xf32>,
1816     %out: tensor<100xf32>) {
1817   %c0 = arith.constant 0 : index
1818   %c1 = arith.constant 1 : index
1819   %num_threads = arith.constant 100 : index
1820   %result = scf.forall (%thread_idx) =  (%c0) to (%num_threads) step (%c1) shared_outs(%o = %out) -> tensor<100xf32> {
1821       %1 = tensor.extract_slice %in[%thread_idx][1][1] : tensor<100xf32> to tensor<1xf32>
1822       scf.forall.in_parallel {
1823         tensor.parallel_insert_slice %1 into %o[%thread_idx][1][1] :
1824           tensor<1xf32> into tensor<100xf32>
1825       } {mapping = [#gpu.thread<x>]}
1826   }
1827   return
1830 func.func @normalized_forall_elide_terminator() -> () {
1831   %num_threads = arith.constant 100 : index
1832   scf.forall (%thread_idx) in (%num_threads) {
1833     scf.forall.in_parallel {
1834     }
1835   } {mapping = [#gpu.thread<x>]}
1836   return
1839 --------------------------------------------------------------------------------
1841 (toplevel
1842   (operation
1843     (custom_operation
1844       (func_dialect
1845         (symbol_ref_id)
1846         (func_arg_list
1847           (value_use)
1848           (type
1849             (builtin_type
1850               (tensor_type
1851                 (dim_list
1852                   (float_type)))))
1853           (value_use)
1854           (type
1855             (builtin_type
1856               (tensor_type
1857                 (dim_list
1858                   (float_type))))))
1859         (region
1860           (entry_block
1861             (operation
1862               (op_result
1863                 (value_use))
1864               (custom_operation
1865                 (arith_dialect
1866                   (integer_literal)
1867                   (type
1868                     (builtin_type
1869                       (index_type))))))
1870             (operation
1871               (op_result
1872                 (value_use))
1873               (custom_operation
1874                 (arith_dialect
1875                   (integer_literal)
1876                   (type
1877                     (builtin_type
1878                       (index_type))))))
1879             (operation
1880               (op_result
1881                 (value_use))
1882               (custom_operation
1883                 (scf_dialect
1884                   (value_use)
1885                   (value_use)
1886                   (value_use)
1887                   (value_use)
1888                   (type
1889                     (builtin_type
1890                       (tensor_type
1891                         (dim_list
1892                           (float_type)))))
1893                   (region
1894                     (entry_block
1895                       (operation
1896                         (op_result
1897                           (value_use))
1898                         (custom_operation
1899                           (tensor_dialect
1900                             (value_use)
1901                             (value_use)
1902                             (integer_literal)
1903                             (integer_literal)
1904                             (type
1905                               (builtin_type
1906                                 (tensor_type
1907                                   (dim_list
1908                                     (float_type)))))
1909                             (type
1910                               (builtin_type
1911                                 (tensor_type
1912                                   (dim_list
1913                                     (float_type))))))))
1914                       (operation
1915                         (custom_operation
1916                           (scf_dialect
1917                             (region
1918                               (entry_block
1919                                 (operation
1920                                   (custom_operation
1921                                     (tensor_dialect
1922                                       (value_use)
1923                                       (value_use)
1924                                       (value_use)
1925                                       (integer_literal)
1926                                       (integer_literal)
1927                                       (type
1928                                         (builtin_type
1929                                           (tensor_type
1930                                             (dim_list
1931                                               (float_type)))))
1932                                       (type
1933                                         (builtin_type
1934                                           (tensor_type
1935                                             (dim_list
1936                                               (float_type))))))))))))))))))
1937             (operation
1938               (custom_operation
1939                 (func_dialect))))))))
1940   (operation
1941     (custom_operation
1942       (func_dialect
1943         (symbol_ref_id)
1944         (func_arg_list
1945           (value_use)
1946           (type
1947             (builtin_type
1948               (tensor_type
1949                 (dim_list
1950                   (float_type)))))
1951           (value_use)
1952           (type
1953             (builtin_type
1954               (tensor_type
1955                 (dim_list
1956                   (float_type))))))
1957         (region
1958           (entry_block
1959             (operation
1960               (op_result
1961                 (value_use))
1962               (custom_operation
1963                 (arith_dialect
1964                   (integer_literal)
1965                   (type
1966                     (builtin_type
1967                       (index_type))))))
1968             (operation
1969               (op_result
1970                 (value_use))
1971               (custom_operation
1972                 (arith_dialect
1973                   (integer_literal)
1974                   (type
1975                     (builtin_type
1976                       (index_type))))))
1977             (operation
1978               (op_result
1979                 (value_use))
1980               (custom_operation
1981                 (arith_dialect
1982                   (integer_literal)
1983                   (type
1984                     (builtin_type
1985                       (index_type))))))
1986             (operation
1987               (op_result
1988                 (value_use))
1989               (custom_operation
1990                 (scf_dialect
1991                   (value_use)
1992                   (value_use)
1993                   (value_use)
1994                   (value_use)
1995                   (value_use)
1996                   (value_use)
1997                   (type
1998                     (builtin_type
1999                       (tensor_type
2000                         (dim_list
2001                           (float_type)))))
2002                   (region
2003                     (entry_block
2004                       (operation
2005                         (op_result
2006                           (value_use))
2007                         (custom_operation
2008                           (tensor_dialect
2009                             (value_use)
2010                             (value_use)
2011                             (integer_literal)
2012                             (integer_literal)
2013                             (type
2014                               (builtin_type
2015                                 (tensor_type
2016                                   (dim_list
2017                                     (float_type)))))
2018                             (type
2019                               (builtin_type
2020                                 (tensor_type
2021                                   (dim_list
2022                                     (float_type))))))))
2023                       (operation
2024                         (custom_operation
2025                           (scf_dialect
2026                             (region
2027                               (entry_block
2028                                 (operation
2029                                   (custom_operation
2030                                     (tensor_dialect
2031                                       (value_use)
2032                                       (value_use)
2033                                       (value_use)
2034                                       (integer_literal)
2035                                       (integer_literal)
2036                                       (type
2037                                         (builtin_type
2038                                           (tensor_type
2039                                             (dim_list
2040                                               (float_type)))))
2041                                       (type
2042                                         (builtin_type
2043                                           (tensor_type
2044                                             (dim_list
2045                                               (float_type))))))))))
2046                             (attribute
2047                               (dictionary_attribute
2048                                 (attribute_entry
2049                                   (bare_id)
2050                                   (attribute_value
2051                                     (dialect_attribute
2052                                       (pretty_dialect_item
2053                                         (dialect_namespace)
2054                                         (dialect_ident)
2055                                         (pretty_dialect_item_body)))))))))))))))
2056             (operation
2057               (custom_operation
2058                 (func_dialect))))))))
2059   (operation
2060     (custom_operation
2061       (func_dialect
2062         (symbol_ref_id)
2063         (func_arg_list)
2064         (func_return
2065           (type_list_attr_parens))
2066         (region
2067           (entry_block
2068             (operation
2069               (op_result
2070                 (value_use))
2071               (custom_operation
2072                 (arith_dialect
2073                   (integer_literal)
2074                   (type
2075                     (builtin_type
2076                       (index_type))))))
2077             (operation
2078               (custom_operation
2079                 (scf_dialect
2080                   (value_use)
2081                   (value_use)
2082                   (region
2083                     (entry_block
2084                       (operation
2085                         (custom_operation
2086                           (scf_dialect
2087                             (region))))))
2088                   (attribute
2089                     (dictionary_attribute
2090                       (attribute_entry
2091                         (bare_id)
2092                         (attribute_value
2093                           (dialect_attribute
2094                             (pretty_dialect_item
2095                               (dialect_namespace)
2096                               (dialect_ident)
2097                               (pretty_dialect_item_body))))))))))
2098             (operation
2099               (custom_operation
2100                 (func_dialect)))))))))