xref: /llvm-project/mlir/test/Transforms/test-pattern-selective-replacement.mlir (revision cda6aa78f8e7346382a204306c4d86ffbab99785)
1// RUN: mlir-opt -allow-unregistered-dialect -split-input-file -test-pattern-selective-replacement -verify-diagnostics %s | FileCheck %s
2
3// Test that operations can be selectively replaced.
4
5// CHECK-LABEL: @test1
6// CHECK-SAME: %[[ARG0:.*]]: i32, %[[ARG1:.*]]: i32
7func.func @test1(%arg0: i32, %arg1 : i32) -> () {
8  // CHECK: arith.addi %[[ARG1]], %[[ARG1]]
9  // CHECK-NEXT: "test.return"(%[[ARG0]]
10  %cast = "test.cast"(%arg0, %arg1) : (i32, i32) -> (i32)
11  %non_terminator = arith.addi %cast, %cast : i32
12  "test.return"(%cast, %non_terminator) : (i32, i32) -> ()
13}
14
15// -----
16