Skip to content

Commit fdcb135

Browse files
committed
add mlir-use-nameloc-as-prefix and set to true and "fix" tests that break
1 parent 447bce7 commit fdcb135

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

mlir/lib/IR/AsmPrinter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ struct AsmPrinterOptions {
196196
llvm::cl::desc("Print unique SSA ID numbers for values, block arguments "
197197
"and naming conflicts across all regions")};
198198

199-
llvm::cl::opt<bool> useNameLocAsPrefix{
200-
"mlir-use-nameloc-as-prefix", llvm::cl::init(false),
201-
llvm::cl::desc("TODO")};
199+
llvm::cl::opt<bool> useNameLocAsPrefix{"mlir-use-nameloc-as-prefix",
200+
llvm::cl::init(true),
201+
llvm::cl::desc("TODO")};
202202
};
203203
} // namespace
204204

mlir/test/IR/locations.mlir

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func.func @inline_notation() -> i32 {
1313
// CHECK: arith.constant 4 : index loc(callsite("foo" at "mysource.cc":10:8))
1414
%2 = arith.constant 4 : index loc(callsite("foo" at "mysource.cc":10:8))
1515

16-
// CHECK: affine.for %arg0 loc("IVlocation") = 0 to 8 {
16+
// CHECK: affine.for %IVlocation loc("IVlocation") = 0 to 8 {
1717
// CHECK: } loc(fused["foo", "mysource.cc":10:8])
1818
affine.for %i0 loc("IVlocation") = 0 to 8 {
1919
} loc(fused["foo", "mysource.cc":10:8])
@@ -26,7 +26,7 @@ func.func @inline_notation() -> i32 {
2626
affine.if #set0(%2) {
2727
} loc(fused<"myPass">["foo"])
2828

29-
// CHECK: return %0 : i32 loc(unknown)
29+
// CHECK: return %foo : i32 loc(unknown)
3030
return %1 : i32 loc(unknown)
3131
}
3232

@@ -62,7 +62,7 @@ func.func @escape_strings() {
6262
// CHECK-LABEL: func @argLocs(
6363
// CHECK-SAME: %arg0: i32 loc({{.*}}locations.mlir":[[# @LINE+1]]:20),
6464
func.func @argLocs(%x: i32,
65-
// CHECK-SAME: %arg1: i64 loc("hotdog")
65+
// CHECK-SAME: %hotdog: i64 loc("hotdog")
6666
%y: i64 loc("hotdog")) {
6767
return
6868
}
@@ -73,11 +73,11 @@ func.func @argLocs(%x: i32,
7373
// CHECK-NEXT: ^bb0(%arg0: i32 loc({{.*}}locations.mlir":[[# @LINE+2]]:7),
7474
// CHECK-ALIAS-NEXT: ^bb0(%arg0: i32 loc({{.*}}locations.mlir":[[# @LINE+1]]:7),
7575
^bb0(%x: i32,
76-
// CHECK-SAME: %arg1: i32 loc("cheetos"),
77-
// CHECK-ALIAS-SAME: %arg1: i32 loc("cheetos"),
76+
// CHECK-SAME: %cheetos: i32 loc("cheetos"),
77+
// CHECK-ALIAS-SAME: %cheetos: i32 loc("cheetos"),
7878
%y: i32 loc("cheetos"),
79-
// CHECK-SAME: %arg2: i32 loc("out_of_line_location2")):
80-
// CHECK-ALIAS-SAME: %arg2: i32 loc("out_of_line_location2")):
79+
// CHECK-SAME: %out_of_line_location2: i32 loc("out_of_line_location2")):
80+
// CHECK-ALIAS-SAME: %out_of_line_location2: i32 loc("out_of_line_location2")):
8181
%z: i32 loc("out_of_line_location2")):
8282
%1 = arith.addi %x, %y : i32
8383
"foo.yield"(%1) : (i32) -> ()

mlir/test/IR/pretty-locations.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ func.func @inline_notation() -> i32 {
2727
// CHECK: "foo.op"() : () -> () #test.custom_location<"foo.mlir" * 1234>
2828
"foo.op"() : () -> () loc(#test.custom_location<"foo.mlir" * 1234>)
2929

30-
// CHECK: return %0 : i32 [unknown]
30+
// CHECK: return %foo : i32 [unknown]
3131
return %1 : i32 loc(unknown)
3232
}

mlir/test/IR/pretty_printed_region_op.mlir

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
func.func @pretty_printed_region_op(%arg0 : f32, %arg1 : f32) -> (f32) {
88
// CHECK-CUSTOM: test.pretty_printed_region %arg1, %arg0 start test.special.op end : (f32, f32) -> f32
9-
// CHECK-GENERIC: "test.pretty_printed_region"(%arg1, %arg0)
10-
// CHECK-GENERIC: ^bb0(%arg[[x:[0-9]+]]: f32, %arg[[y:[0-9]+]]: f32
11-
// CHECK-GENERIC: %[[RES:.*]] = "test.special.op"(%arg[[x]], %arg[[y]]) : (f32, f32) -> f32
9+
// CHECK-GENERIC: %some_NameLoc = "test.pretty_printed_region"(%arg1, %arg0)
10+
// CHECK-GENERIC: ^bb0(%some_NameLoc_[[x:[0-9]+]]: f32, %some_NameLoc_[[y:[0-9]+]]: f32
11+
// CHECK-GENERIC: %[[RES:.*]] = "test.special.op"(%some_NameLoc_[[x]], %some_NameLoc_[[y]]) : (f32, f32) -> f32
1212
// CHECK-GENERIC: "test.return"(%[[RES]]) : (f32) -> ()
1313
// CHECK-GENERIC: : (f32, f32) -> f32
1414

@@ -37,9 +37,9 @@ func.func @pretty_printed_region_op(%arg0 : f32, %arg1 : f32) -> (f32) {
3737
// -----
3838

3939
func.func @pretty_printed_region_op_deferred_loc(%arg0 : f32, %arg1 : f32) -> (f32) {
40-
// CHECK-LOCATION: "test.pretty_printed_region"(%arg1, %arg0)
41-
// CHECK-LOCATION: ^bb0(%arg[[x:[0-9]+]]: f32 loc("foo"), %arg[[y:[0-9]+]]: f32 loc("foo")
42-
// CHECK-LOCATION: %[[RES:.*]] = "test.special.op"(%arg[[x]], %arg[[y]]) : (f32, f32) -> f32
40+
// CHECK-LOCATION: %foo = "test.pretty_printed_region"(%arg1, %arg0)
41+
// CHECK-LOCATION: ^bb0(%foo_[[x:[0-9]+]]: f32 loc("foo"), %foo_[[y:[0-9]+]]: f32 loc("foo")
42+
// CHECK-LOCATION: %[[RES:.*]] = "test.special.op"(%foo_[[x]], %foo_[[y]]) : (f32, f32) -> f32
4343
// CHECK-LOCATION: "test.return"(%[[RES]]) : (f32) -> ()
4444
// CHECK-LOCATION: : (f32, f32) -> f32
4545

mlir/test/IR/wrapping_op.mlir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
// CHECK-GENERIC: "func.func"
66
// CHECK-GENERIC-SAME: sym_name = "wrapping_op"
77
func.func @wrapping_op(%arg0 : i32, %arg1 : f32) -> (i3, i2, i1) {
8-
// CHECK: %0:3 = test.wrapping_region wraps "some.op"(%arg1, %arg0) {test.attr = "attr"} : (f32, i32) -> (i1, i2, i3)
8+
// CHECK: %some_NameLoc, %some_NameLoc_0, %some_NameLoc_1 = test.wrapping_region wraps "some.op"(%arg1, %arg0) {test.attr = "attr"} : (f32, i32) -> (i1, i2, i3)
99
// CHECK-GENERIC: "test.wrapping_region"() ({
10-
// CHECK-GENERIC: %[[NESTED_RES:.*]]:3 = "some.op"(%arg1, %arg0) {test.attr = "attr"} : (f32, i32) -> (i1, i2, i3) loc("some_NameLoc")
11-
// CHECK-GENERIC: "test.return"(%[[NESTED_RES]]#0, %[[NESTED_RES]]#1, %[[NESTED_RES]]#2) : (i1, i2, i3) -> () loc("some_NameLoc")
10+
// CHECK-GENERIC: %some_NameLoc_2, %some_NameLoc_3, %some_NameLoc_4 = "some.op"(%arg1, %arg0) {test.attr = "attr"} : (f32, i32) -> (i1, i2, i3) loc("some_NameLoc")
11+
// CHECK-GENERIC: "test.return"(%some_NameLoc_2, %some_NameLoc_3, %some_NameLoc_4) : (i1, i2, i3) -> () loc("some_NameLoc")
1212
// CHECK-GENERIC: }) : () -> (i1, i2, i3) loc("some_NameLoc")
1313
%res:3 = test.wrapping_region wraps "some.op"(%arg1, %arg0) { test.attr = "attr" } : (f32, i32) -> (i1, i2, i3) loc("some_NameLoc")
1414
return %res#2, %res#1, %res#0 : i3, i2, i1

mlir/test/mlir-tblgen/pattern.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ func.func @returnTypeAndLocation(%arg0 : i32) -> i1 {
678678
%0 = "test.source_op"(%arg0) {tag = 66 : i32} : (i32) -> i1
679679
// CHECK: "test.op_x"(%arg0) : (i32) -> i32 loc("loc1")
680680
// CHECK: "test.op_x"(%arg0) : (i32) -> i32 loc("loc2")
681-
// CHECK: "test.two_to_one"(%0, %1) : (i32, i32) -> i1
681+
// CHECK: "test.two_to_one"(%loc1, %loc2) : (i32, i32) -> i1
682682
return %0 : i1
683683
}
684684

0 commit comments

Comments
 (0)