xref: /llvm-project/mlir/test/Pass/pipeline-stats-nested.mlir (revision d41b3bf7c37d36f02e55662c31c14aecdcdf9b9b)
1// REQUIRES: asserts
2// Check that statistics in nested pipelines are not ignored and that this works with and without threading.
3// RUN: mlir-opt %s -verify-each=true -pass-pipeline='builtin.module(builtin.module(func.func(test-stats-pass,test-stats-pass)))' -mlir-pass-statistics -mlir-pass-statistics-display=list -mlir-disable-threading 2>&1 | FileCheck -check-prefix=LIST %s
4// RUN: mlir-opt %s -verify-each=true -pass-pipeline='builtin.module(builtin.module(func.func(test-stats-pass,test-stats-pass)))' -mlir-pass-statistics -mlir-pass-statistics-display=list                         2>&1 | FileCheck -check-prefix=LIST %s
5
6// RUN: mlir-opt %s -verify-each=true -pass-pipeline='builtin.module(builtin.module(func.func(test-stats-pass,test-stats-pass)))' -mlir-pass-statistics -mlir-pass-statistics-display=pipeline -mlir-disable-threading 2>&1 | FileCheck -check-prefix=PIPELINE %s
7// RUN: mlir-opt %s -verify-each=true -pass-pipeline='builtin.module(builtin.module(func.func(test-stats-pass,test-stats-pass)))' -mlir-pass-statistics -mlir-pass-statistics-display=pipeline                         2>&1 | FileCheck -check-prefix=PIPELINE %s
8
9// Check for the correct statistic values.
10// Each test-stats-pass will count two ops: the func.func and the func.return .
11//      LIST: (S) 4 num-ops
12// LIST-NEXT: (S) 4 num-ops2
13//      PIPELINE: (S) 2 num-ops
14// PIPELINE-NEXT: (S) 2 num-ops2
15//      PIPELINE: (S) 2 num-ops
16// PIPELINE-NEXT: (S) 2 num-ops2
17
18module {
19  module {
20    func.func @foo() {
21      return
22    }
23  }
24}
25