1// RUN: mlir-opt %s -split-input-file -test-constant-fold -mlir-print-debuginfo | FileCheck %s 2 3// CHECK-LABEL: func @fold_and_merge 4func.func @fold_and_merge() -> (i32, i32) { 5 // CHECK-NEXT: [[C:%.+]] = arith.constant 6 : i32 loc(#[[UnknownLoc:.*]]) 6 %0 = arith.constant 1 : i32 loc("fold_and_merge":0:0) 7 %1 = arith.constant 5 : i32 loc("fold_and_merge":1:0) 8 %2 = arith.addi %0, %1 : i32 loc("fold_and_merge":2:0) 9 10 %3 = arith.constant 6 : i32 loc("fold_and_merge":3:0) 11 12 return %2, %3: i32, i32 13} 14// CHECK: #[[UnknownLoc]] = loc(unknown) 15 16// ----- 17 18// CHECK-LABEL: func @materialize_different_dialect 19func.func @materialize_different_dialect() -> (f32, f32) { 20 // CHECK: arith.constant 1.{{0*}}e+00 : f32 loc(#[[UnknownLoc:.*]]) 21 %0 = arith.constant -1.0 : f32 loc("materialize_different_dialect":0:0) 22 %1 = math.absf %0 : f32 loc("materialize_different_dialect":1:0) 23 %2 = arith.constant 1.0 : f32 loc("materialize_different_dialect":2:0) 24 25 return %1, %2: f32, f32 26} 27// CHECK: #[[UnknownLoc]] = loc(unknown) 28 29// ----- 30 31// CHECK-LABEL: func @materialize_in_front 32func.func @materialize_in_front(%arg0: memref<8xi32>) { 33 // CHECK-NEXT: arith.constant 6 : i32 loc(#[[UnknownLoc:.*]]) 34 affine.for %arg1 = 0 to 8 { 35 %1 = arith.constant 1 : i32 loc("materialize_in_front":0:0) 36 %2 = arith.constant 5 : i32 loc("materialize_in_front":1:0) 37 %3 = arith.addi %1, %2 : i32 loc("materialize_in_front":2:0) 38 memref.store %3, %arg0[%arg1] : memref<8xi32> 39 } 40 return 41} loc("materialize_in_front":3:0) 42// CHECK: #[[UnknownLoc]] = loc(unknown) 43