1// RUN: mlir-opt %s \ 2// RUN: -test-print-number-of-operation-executions \ 3// RUN: -split-input-file 2>&1 \ 4// RUN: | FileCheck %s 5 6// CHECK-LABEL: Number of executions: empty 7func @empty() { 8 // CHECK: Operation: std.return 9 // CHECK-NEXT: Number of executions: 1 10 return 11} 12 13// ----- 14 15// CHECK-LABEL: Number of executions: propagate_parent_num_executions 16func @propagate_parent_num_executions() { 17 // CHECK: Operation: std.constant 18 // CHECK-NEXT: Number of executions: 1 19 %c0 = constant 0 : index 20 // CHECK: Operation: std.constant 21 // CHECK-NEXT: Number of executions: 1 22 %c1 = constant 1 : index 23 // CHECK: Operation: std.constant 24 // CHECK-NEXT: Number of executions: 1 25 %c2 = constant 2 : index 26 27 // CHECK-DAG: Operation: scf.for 28 // CHECK-NEXT: Number of executions: 1 29 scf.for %i = %c0 to %c2 step %c1 { 30 // CHECK-DAG: Operation: async.execute 31 // CHECK-NEXT: Number of executions: 2 32 async.execute { 33 // CHECK-DAG: Operation: async.yield 34 // CHECK-NEXT: Number of executions: 2 35 async.yield 36 } 37 } 38 39 return 40} 41 42// ----- 43 44// CHECK-LABEL: Number of executions: clear_num_executions 45func @clear_num_executions(%step : index) { 46 // CHECK: Operation: std.constant 47 // CHECK-NEXT: Number of executions: 1 48 %c0 = constant 0 : index 49 // CHECK: Operation: std.constant 50 // CHECK-NEXT: Number of executions: 1 51 %c2 = constant 2 : index 52 53 // CHECK: Operation: scf.for 54 // CHECK-NEXT: Number of executions: 1 55 scf.for %i = %c0 to %c2 step %step { 56 // CHECK: Operation: async.execute 57 // CHECK-NEXT: Number of executions: <unknown> 58 async.execute { 59 // CHECK: Operation: async.yield 60 // CHECK-NEXT: Number of executions: <unknown> 61 async.yield 62 } 63 } 64 65 return 66} 67