Skip to content

Commit bbca902

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

File tree

7 files changed

+48
-35
lines changed

7 files changed

+48
-35
lines changed

flang/test/Lower/OpenMP/map-component-ref.f90

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,32 @@
1-
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
2-
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
1+
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s --check-prefix=CHECK-FLANG
2+
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s --check-prefix=CHECK-BBC
33

44
! CHECK-LABEL: func.func @_QPfoo1
5-
! CHECK: %[[V0:[0-9]+]] = fir.alloca !fir.type<_QFfoo1Tt0{a0:i32,a1:i32}> {bindc_name = "a", uniq_name = "_QFfoo1Ea"}
6-
! CHECK: %[[V1:[0-9]+]]:2 = hlfir.declare %[[V0]] {uniq_name = "_QFfoo1Ea"} : (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>) -> (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>, !fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>)
7-
! CHECK: %[[V2:[0-9]+]] = hlfir.designate %[[V1]]#0{"a1"} : (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>) -> !fir.ref<i32>
8-
! CHECK: %[[V3:[0-9]+]] = omp.map.info var_ptr(%[[V2]] : !fir.ref<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !fir.ref<i32> {name = "a%a1"}
9-
! CHECK: %[[V4:[0-9]+]] = omp.map.info var_ptr(%[[V1]]#1 : !fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>, !fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>) map_clauses(tofrom) capture(ByRef) members(%[[V3]] : [1] : !fir.ref<i32>) -> !fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>> {name = "a", partial_map = true}
10-
! CHECK: omp.target map_entries(%[[V4]] -> %arg0, %[[V3]] -> %arg1 : !fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>, !fir.ref<i32>) {
11-
! CHECK: %[[V5:[0-9]+]]:2 = hlfir.declare %arg0 {uniq_name = "_QFfoo1Ea"} : (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>) -> (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>, !fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>)
12-
! CHECK: %c0_i32 = arith.constant 0 : i32
13-
! CHECK: %[[V6:[0-9]+]] = hlfir.designate %[[V5]]#0{"a1"} : (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>) -> !fir.ref<i32>
14-
! CHECK: hlfir.assign %c0_i32 to %[[V6]] : i32, !fir.ref<i32>
15-
! CHECK: omp.terminator
16-
! CHECK: }
5+
! CHECK-FLANG: %[[V0:[0-9]+]] = fir.alloca !fir.type<_QFfoo1Tt0{a0:i32,a1:i32}> {bindc_name = "a", uniq_name = "_QFfoo1Ea"}
6+
! CHECK-FLANG: %[[V1:[0-9]+]]:2 = hlfir.declare %[[V0]] {uniq_name = "_QFfoo1Ea"} : (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>) -> (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>, !fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>)
7+
! CHECK-FLANG: %[[V2:[0-9]+]] = hlfir.designate %[[V1]]#0{"a1"} : (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>) -> !fir.ref<i32>
8+
! CHECK-FLANG: %[[V3:[0-9]+]] = omp.map.info var_ptr(%[[V2]] : !fir.ref<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !fir.ref<i32> {name = "a%a1"}
9+
! CHECK-FLANG: %[[V4:[0-9]+]] = omp.map.info var_ptr(%[[V1]]#1 : !fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>, !fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>) map_clauses(tofrom) capture(ByRef) members(%[[V3]] : [1] : !fir.ref<i32>) -> !fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>> {name = "a", partial_map = true}
10+
! CHECK-FLANG: omp.target map_entries(%[[V4]] -> %arg0, %[[V3]] -> %arg1 : !fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>, !fir.ref<i32>) {
11+
! CHECK-FLANG: %[[V5:[0-9]+]]:2 = hlfir.declare %arg0 {uniq_name = "_QFfoo1Ea"} : (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>) -> (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>, !fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>)
12+
! CHECK-FLANG: %c0_i32 = arith.constant 0 : i32
13+
! CHECK-FLANG: %[[V6:[0-9]+]] = hlfir.designate %[[V5]]#0{"a1"} : (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>) -> !fir.ref<i32>
14+
! CHECK-FLANG: hlfir.assign %c0_i32 to %[[V6]] : i32, !fir.ref<i32>
15+
! CHECK-FLANG: omp.terminator
16+
! CHECK-FLANG: }
17+
18+
! CHECK-BBC: %[[V0:[0-9]+]] = fir.alloca !fir.type<_QFfoo1Tt0{a0:i32,a1:i32}> {bindc_name = "a", uniq_name = "_QFfoo1Ea"}
19+
! CHECK-BBC: %[[V1:[0-9]+]]:2 = hlfir.declare %[[V0]] {uniq_name = "_QFfoo1Ea"} : (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>) -> (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>, !fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>)
20+
! CHECK-BBC: %[[V2:[0-9]+]] = hlfir.designate %[[V1]]#0{"a1"} : (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>) -> !fir.ref<i32>
21+
! CHECK-BBC: %a25a1 = omp.map.info var_ptr(%[[V2]] : !fir.ref<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !fir.ref<i32> {name = "a%a1"}
22+
! CHECK-BBC: %[[V4:[0-9]+]] = omp.map.info var_ptr(%[[V1]]#1 : !fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>, !fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>) map_clauses(tofrom) capture(ByRef) members(%a25a1 : [1] : !fir.ref<i32>) -> !fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>> {name = "a", partial_map = true}
23+
! CHECK-BBC: omp.target map_entries(%[[V4]] -> %arg0, %a25a1 -> %a25a1_3 : !fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>, !fir.ref<i32>) {
24+
! CHECK-BBC: %[[V5:[0-9]+]]:2 = hlfir.declare %arg0 {uniq_name = "_QFfoo1Ea"} : (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>) -> (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>, !fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>)
25+
! CHECK-BBC: %c0_i32 = arith.constant 0 : i32
26+
! CHECK-BBC: %[[V6:[0-9]+]] = hlfir.designate %[[V5]]#0{"a1"} : (!fir.ref<!fir.type<_QFfoo1Tt0{a0:i32,a1:i32}>>) -> !fir.ref<i32>
27+
! CHECK-BBC: hlfir.assign %c0_i32 to %[[V6]] : i32, !fir.ref<i32>
28+
! CHECK-BBC: omp.terminator
29+
! CHECK-BBC: }
1730

1831
subroutine foo1()
1932
implicit none

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)