[Mlir-commits] [mlir] [mlir][spirv] Add tests for `scf.while` and `scf.for` in `convert-to-spirv` pass (PR #102528)

Angel Zhang llvmlistbot at llvm.org
Mon Aug 12 07:26:46 PDT 2024


================
@@ -45,3 +56,30 @@ func.func @while(%arg0: i32, %arg1: i32) -> i32 {
   }
   return %0 : i32
 }
+
+// CHECK-LABEL: @for
+// CHECK:       spirv.mlir.loop {
+// CHECK:         spirv.Branch ^[[HEADER:.*]](%{{.*}}, %{{.*}}, %{{.*}} : i32, f32, f32)
+// CHECK:       ^[[HEADER]]
+// CHECK:         spirv.BranchConditional %{{.*}}, ^[[BODY:.*]], ^[[MERGE:.*]]
+// CHECK:       ^[[BODY]]
+// CHECK-DAG:     spirv.Store "Function"
+// CHECK-DAG:     spirv.Store "Function"
+// CHECK:       spirv.Branch ^[[HEADER]]
+// CHECK:       ^[[MERGE]]
+// CHECK:         spirv.mlir.merge
+// CHECK:      }
+// CHECK-DAG:  spirv.Load "Function"
+// CHECK-DAG:  spirv.Load "Function"
----------------
angelz913 wrote:

This is similar to the `scf.while` case, except that the `scf.yield` is producing two results, which corresponds to two `spirv.Store "Function"` and `spirv.Load "Function"` pairs. 

https://github.com/llvm/llvm-project/pull/102528


More information about the Mlir-commits mailing list