Composite pass allows to run sequence of passes in the loop until fixed point or maximum number of iterations is reached. The usual candidates are canonicalize+CSE as canonicalize can open more opportunities for CSE and vice-versa.
27 lines
883 B
MLIR
27 lines
883 B
MLIR
// RUN: mlir-opt %s --log-actions-to=- --test-composite-fixed-point-pass -split-input-file | FileCheck %s
|
|
// RUN: mlir-opt %s --log-actions-to=- --composite-fixed-point-pass='name=TestCompositePass pipeline=any(canonicalize,cse)' -split-input-file | FileCheck %s
|
|
|
|
// CHECK-LABEL: running `TestCompositePass`
|
|
// CHECK: running `Canonicalizer`
|
|
// CHECK: running `CSE`
|
|
// CHECK-NOT: running `Canonicalizer`
|
|
// CHECK-NOT: running `CSE`
|
|
func.func @test() {
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
// CHECK-LABEL: running `TestCompositePass`
|
|
// CHECK: running `Canonicalizer`
|
|
// CHECK: running `CSE`
|
|
// CHECK: running `Canonicalizer`
|
|
// CHECK: running `CSE`
|
|
// CHECK-NOT: running `Canonicalizer`
|
|
// CHECK-NOT: running `CSE`
|
|
func.func @test() {
|
|
// this constant will be canonicalized away, causing another pass iteration
|
|
%0 = arith.constant 1.5 : f32
|
|
return
|
|
}
|