47 lines · plain
1// RUN: mlir-opt %s -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file -mlir-print-debuginfo | FileCheck %s2 3// CHECK-LABEL: func @merge_constants4func.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, index11}12// CHECK: #[[UnknownLoc]] = loc(unknown)13 14// -----15 16// CHECK-LABEL: func @simple_hoist17func.func @simple_hoist(%arg0: memref<8xi32>) -> i32 {18 // CHECK: arith.constant 88 : i32 loc(#[[ConstLoc2:.*]])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>24 25 %2 = arith.constant 88 : i32 loc("simple_hoist":2:0)26 27 return %2 : i3228}29// CHECK-DAG: #[[ConstLoc0]] = loc("simple_hoist":0:0)30// CHECK-DAG: #[[ConstLoc1]] = loc("simple_hoist":1:0)31// CHECK-DAG: #[[ConstLoc2]] = loc("simple_hoist":2:0)32 33// -----34 35// CHECK-LABEL: func @hoist_and_merge36func.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 return45} loc("hoist_and_merge":2:0)46// CHECK: #[[UnknownLoc]] = loc(unknown)47