1// RUN: mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(test-foo-analysis))' %s 2>&1 | FileCheck %s 2 3// CHECK-LABEL: function: @test_default_init 4func.func @test_default_init() -> () { 5 // CHECK: a -> 0 6 "test.foo"() {tag = "a"} : () -> () 7 return 8} 9 10// ----- 11 12// CHECK-LABEL: function: @test_one_join 13func.func @test_one_join() -> () { 14 // CHECK: a -> 0 15 "test.foo"() {tag = "a"} : () -> () 16 // CHECK: b -> 1 17 "test.foo"() {tag = "b", foo = 1 : ui64} : () -> () 18 return 19} 20 21// ----- 22 23// CHECK-LABEL: function: @test_two_join 24func.func @test_two_join() -> () { 25 // CHECK: a -> 0 26 "test.foo"() {tag = "a"} : () -> () 27 // CHECK: b -> 1 28 "test.foo"() {tag = "b", foo = 1 : ui64} : () -> () 29 // CHECK: c -> 0 30 "test.foo"() {tag = "c", foo = 1 : ui64} : () -> () 31 return 32} 33 34// ----- 35 36// CHECK-LABEL: function: @test_fork 37func.func @test_fork() -> () { 38 // CHECK: init -> 1 39 "test.branch"() [^bb0, ^bb1] {tag = "init", foo = 1 : ui64} : () -> () 40 41^bb0: 42 // CHECK: a -> 3 43 "test.branch"() [^bb2] {tag = "a", foo = 2 : ui64} : () -> () 44 45^bb1: 46 // CHECK: b -> 5 47 "test.branch"() [^bb2] {tag = "b", foo = 4 : ui64} : () -> () 48 49^bb2: 50 // CHECK: end -> 6 51 "test.foo"() {tag = "end"} : () -> () 52 return 53 54} 55 56// ----- 57 58// CHECK-LABEL: function: @test_simple_loop 59func.func @test_simple_loop() -> () { 60 // CHECK: init -> 1 61 "test.branch"() [^bb0] {tag = "init", foo = 1 : ui64} : () -> () 62 63^bb0: 64 // CHECK: a -> 1 65 "test.foo"() {tag = "a", foo = 3 : ui64} : () -> () 66 "test.branch"() [^bb0, ^bb1] : () -> () 67 68^bb1: 69 // CHECK: end -> 3 70 "test.foo"() {tag = "end"} : () -> () 71 return 72} 73 74// ----- 75 76// CHECK-LABEL: function: @test_double_loop 77func.func @test_double_loop() -> () { 78 // CHECK: init -> 2 79 "test.branch"() [^bb0] {tag = "init", foo = 2 : ui64} : () -> () 80 81^bb0: 82 // CHECK: a -> 1 83 "test.foo"() {tag = "a", foo = 3 : ui64} : () -> () 84 "test.branch"() [^bb0, ^bb1] : () -> () 85 86^bb1: 87 // CHECK: b -> 4 88 "test.foo"() {tag = "b", foo = 5 : ui64} : () -> () 89 "test.branch"() [^bb0, ^bb2] : () -> () 90 91^bb2: 92 // CHECK: end -> 4 93 "test.foo"() {tag = "end"} : () -> () 94 return 95} 96