67 lines · plain
1// RUN: mlir-opt -allow-unregistered-dialect -mlir-elide-elementsattrs-if-larger=2 -view-op-graph %s -o %t 2>&1 | FileCheck -check-prefix=DFG %s2// RUN: mlir-opt -allow-unregistered-dialect -mlir-elide-elementsattrs-if-larger=2 -view-op-graph='print-data-flow-edges=false print-control-flow-edges=true' %s -o %t 2>&1 | FileCheck -check-prefix=CFG %s3 4// DFG-LABEL: digraph G {5// DFG: subgraph {{.*}} {6// DFG: subgraph {{.*}}7// DFG: label = "func.func{{.*}}merge_blocks8// DFG: subgraph {{.*}} {9// DFG: v[[ARG0:.*]] [label = "<res_arg0> %arg0 i32"10// DFG: v[[CONST10:.*]] [{{.*}}label ={{.*}}10 : i3211// DFG: subgraph [[CLUSTER_MERGE_BLOCKS:.*]] {12// DFG: v[[ANCHOR:.*]] [label = " ", shape = plain]13// DFG: label = "test.merge_blocks14// DFG: subgraph {{.*}} {15// DFG: v[[TEST_BR:.*]] [{{.*}}label = "{{.*}}test.br16// DFG: }17// DFG: subgraph {{.*}} {18// DFG: }19// DFG: }20// DFG: v[[TEST_RET:.*]] [{{.*}}label = "{{.*}}test.return21// DFG: v[[ARG0]]:res_arg0:s -> v[[TEST_BR]]:arg_arg0:n22// DFG: v[[CONST10]]:res_c10_i32:s -> v[[TEST_BR]]23// DFG: v[[ANCHOR]] -> v[[TEST_RET]]:arg_1_0:n[ltail = [[CLUSTER_MERGE_BLOCKS]], style = solid];24// DFG: v[[ANCHOR]] -> v[[TEST_RET]]:arg_1_1:n[ltail = [[CLUSTER_MERGE_BLOCKS]], style = solid];25 26// CFG-LABEL: digraph G {27// CFG: subgraph {{.*}} {28// CFG: subgraph {{.*}}29// CFG: label = "func.func{{.*}}merge_blocks30// CFG: subgraph {{.*}} {31// CFG: v[[C1:.*]] [{{.*}}label = "{arith.constant32// CFG: v[[C2:.*]] [{{.*}}label = "{arith.constant33// CFG: v[[C3:.*]] [{{.*}}label = "{arith.constant34// CFG: v[[C4:.*]] [{{.*}}label = "{arith.constant35// CFG: v[[TEST_FUNC:.*]] [{{.*}}label = "{test.func36// CFG: subgraph [[CLUSTER_MERGE_BLOCKS:.*]] {37// CFG: v[[ANCHOR:.*]] [label = " ", shape = plain]38// CFG: label = "test.merge_blocks39// CFG: subgraph {{.*}} {40// CFG: v[[TEST_BR:.*]] [{{.*}}label = "{{.*}}test.br41// CFG: }42// CFG: subgraph {{.*}} {43// CFG: }44// CFG: }45// CFG: v[[TEST_RET:.*]] [{{.*}}label = "{{.*}}test.return46// CFG: v[[C1]] -> v[[C2]]47// CFG: v[[C2]] -> v[[C3]]48// CFG: v[[C3]] -> v[[C4]]49// CFG: v[[C4]] -> v[[TEST_FUNC]]50// CFG: v[[TEST_FUNC]] -> v[[ANCHOR]][lhead = [[CLUSTER_MERGE_BLOCKS]], style = dashed];51// CFG: v[[ANCHOR]] -> v[[TEST_RET]][ltail = [[CLUSTER_MERGE_BLOCKS]], style = dashed];52 53func.func @merge_blocks(%arg0: i32, %arg1 : i32) -> () {54 %0 = arith.constant dense<[[0, 1], [2, 3]]> : tensor<2x2xi32>55 %1 = arith.constant dense<1> : tensor<5xi32>56 %2 = arith.constant dense<[[0, 1]]> : tensor<1x2xi32>57 %a = arith.constant 10 : i3258 %b = "test.func"() : () -> i3259 %3:2 = "test.merge_blocks"() ({60 ^bb0:61 "test.br"(%arg0, %b, %a)[^bb1] : (i32, i32, i32) -> ()62 ^bb1(%arg3 : i32, %arg4 : i32, %arg5: i32):63 "test.return"(%arg3, %arg4) : (i32, i32) -> ()64 }) : () -> (i32, i32)65 "test.return"(%3#0, %3#1) : (i32, i32) -> ()66}67