Back to PBT run

test.mlir

// RUN: loom-raise-opt --loom-lower-graph-memory --mlir-print-op-generic %s | FileCheck %s

module attributes {
} {
  dataflow.graph private @source_memory_graph(
      %start: none, %base: !llvm.ptr, %expected: i32, %desired: i32,
      %index: i64, %cond: i1) -> ()
      attributes {input_segments = array<i32: 5, 0, 0>,
                  result_segments = array<i32: 0, 0, 0>} {
    %ptr = llvm.getelementptr inbounds %base[%index]
        : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<4 x i8>
    %lower = arith.constant 0 : index
    %upper = arith.constant 4 : index
    %step = arith.constant 1 : index
    scf.for %iv = %lower to %upper step %step {
    llvm.fence syncscope("system") acquire
    }
    dataflow.graph.return %start : none
  }
}

// CHECK: "builtin.module"() ({
// CHECK-NEXT:   "dataflow.graph"() <{function_type = (!llvm.ptr, i32, i32, i64, i1, memref<?xi8>) -> (), input_segments = array<i32: 5, 0, 1>, result_segments = array<i32: 0, 0, 0>, sym_name = "source_memory_graph", sym_visibility = "private"}> ({
// CHECK-NEXT:   ^bb0(%arg0: none, %arg1: !llvm.ptr, %arg2: i32, %arg3: i32, %arg4: i64, %arg5: i1, %arg6: memref<?xi8>):
// CHECK-NEXT:     %0 = "arith.constant"() <{value = 0 : index}> : () -> index
// CHECK-NEXT:     %1 = "arith.constant"() <{value = 4 : index}> : () -> index
// CHECK-NEXT:     %2 = "arith.constant"() <{value = 1 : index}> : () -> index
// CHECK-NEXT:     %3 = "arith.index_cast"(%0) : (index) -> i32
// CHECK-NEXT:     %4 = "arith.index_cast"(%1) : (index) -> i32
// CHECK-NEXT:     %5 = "arith.index_cast"(%2) : (index) -> i32
// CHECK-NEXT:     %6:2 = "dataflow.stream"(%3, %4, %5) <{predicate = 2 : i64, step_kind = 0 : i32}> : (i32, i32, i32) -> (i32, i1)
// CHECK-NEXT:     %7 = "dataflow.carry"(%6#1, %arg0, %9) : (i1, none, none) -> none
// CHECK-NEXT:     %8:2 = "dataflow.demux"(%6#1, %7) : (i1, none) -> (none, none)
// CHECK-NEXT:     %9 = "dataflow.fence"(%8#1) <{contract = #dataflow.fence_contract<ordering = acquire, sync_scope = <system>>}> : (none) -> none
// CHECK-NEXT:     "dataflow.graph.return"(%8#0) <{operandSegmentSizes = array<i32: 0, 0, 0, 1>}> : (none) -> ()
// CHECK-NEXT:   }) : () -> ()
// CHECK-NEXT: }) : () -> ()
// CHECK-EMPTY: