[mlir][py] Enable loading only specified dialects during creation. (#121421)
[llvm-project.git] / mlir / test / Transforms / canonicalize-debuginfo.mlir
blob30c8022daa76b77cd67e3c6671de2747cd49f32d
1 // RUN: mlir-opt %s -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file -mlir-print-debuginfo | FileCheck %s
3 // CHECK-LABEL: func @merge_constants
4 func.func @merge_constants() -> (index, index, index, index) {
5   // CHECK-NEXT: arith.constant 42 : index loc(#[[UnknownLoc:.*]])
6   %0 = arith.constant 42 : index loc("merge_constants":0:0)
7   %1 = arith.constant 42 : index loc("merge_constants":1:0)
8   %2 = arith.constant 42 : index loc("merge_constants":2:0)
9   %3 = arith.constant 42 : index loc("merge_constants":2:0)
10   return %0, %1, %2, %3 : index, index, index, index
12 // CHECK: #[[UnknownLoc]] = loc(unknown)
14 // -----
16 // CHECK-LABEL: func @simple_hoist
17 func.func @simple_hoist(%arg0: memref<8xi32>) -> i32 {
18   // CHECK: arith.constant 88 : i32 loc(#[[UnknownLoc:.*]])
19   // CHECK: arith.constant 42 : i32 loc(#[[ConstLoc0:.*]])
20   // CHECK: arith.constant 0 : index loc(#[[ConstLoc1:.*]])
21   %0 = arith.constant 42 : i32 loc("simple_hoist":0:0)
22   %1 = arith.constant 0 : index loc("simple_hoist":1:0)
23   memref.store %0, %arg0[%1] : memref<8xi32>
25   %2 = arith.constant 88 : i32 loc("simple_hoist":2:0)
27   return %2 : i32
29 // CHECK-DAG: #[[UnknownLoc]] = loc(unknown)
30 // CHECK-DAG: #[[ConstLoc0]] = loc("simple_hoist":0:0)
31 // CHECK-DAG: #[[ConstLoc1]] = loc("simple_hoist":1:0)
33 // -----
35 // CHECK-LABEL: func @hoist_and_merge
36 func.func @hoist_and_merge(%arg0: memref<8xi32>) {
37   // CHECK-NEXT: arith.constant 42 : i32 loc(#[[UnknownLoc:.*]])
38   affine.for %arg1 = 0 to 8 {
39     %0 = arith.constant 42 : i32 loc("hoist_and_merge":0:0)
40     %1 = arith.constant 42 : i32 loc("hoist_and_merge":1:0)
41     memref.store %0, %arg0[%arg1] : memref<8xi32>
42     memref.store %1, %arg0[%arg1] : memref<8xi32>
43   }
44   return
45 } loc("hoist_and_merge":2:0)
46 // CHECK: #[[UnknownLoc]] = loc(unknown)