Skip to content

Commit e3540f0

Browse files
committed
Rename accesspath unit test.
If was called accesspath-base, but it's primarily about the uses of the accesspath, not the base. Very confusing.
1 parent 1ac4b4d commit e3540f0

File tree

3 files changed

+44
-36
lines changed

3 files changed

+44
-36
lines changed

lib/SIL/Utils/MemAccessUtils.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -2087,13 +2087,14 @@ struct AccessUseTestVisitor : public AccessUseVisitor {
20872087
}
20882088
};
20892089

2090-
static FunctionTest AccessPathBaseTest("accesspath-base", [](auto &function,
2091-
auto &arguments,
2092-
auto &test) {
2090+
static FunctionTest AccessPathBaseTest("accesspath", [](auto &function,
2091+
auto &arguments,
2092+
auto &test) {
20932093
auto value = arguments.takeValue();
20942094
function.print(llvm::outs());
2095-
llvm::outs() << "Access path base: " << value;
2095+
llvm::outs() << "Access path for: " << value;
20962096
auto accessPathWithBase = AccessPathWithBase::compute(value);
2097+
llvm::outs() << " base: " << accessPathWithBase.base;
20972098
AccessUseTestVisitor visitor;
20982099
visitAccessPathBaseUses(visitor, accessPathWithBase, &function);
20992100
});

test/SILOptimizer/accessbase_unit.sil

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ class C {}
2727
// CHECK: Class [[BOX]] = argument of bb0
2828
// CHECK: Field: var value: T Index: 0
2929
// CHECK-LABEL: end running test {{.*}} on test_phi_nested_access: compute_access_storage with
30-
// CHECK-LABEL: begin running test 3 of 3 on test_phi_nested_access: accesspath-base
31-
// CHECK: Access path base: %6 = argument of bb1
30+
// CHECK-LABEL: begin running test 3 of 3 on test_phi_nested_access: accesspath
31+
// CHECK: Access path for: %6 = argument of bb1
3232
// CHECK: Exact Use: end_access %2
33-
// CHECK-LABEL: end running test 3 of 3 on test_phi_nested_access: accesspath-base
33+
// CHECK-LABEL: end running test 3 of 3 on test_phi_nested_access: accesspath
3434
sil @test_phi_nested_access : $@convention(method) (@guaranteed Box<C>) -> () {
3535
bb1(%box : $Box<C>):
3636
%value_addr = ref_element_addr %box : $Box<C>, #Box.value
@@ -42,7 +42,7 @@ bb1(%box : $Box<C>):
4242
exit(%phi : $Builtin.RawPointer):
4343
specify_test "get_access_base @argument"
4444
specify_test "compute_access_storage @argument"
45-
specify_test "accesspath-base @argument"
45+
specify_test "accesspath @argument"
4646
%retval = tuple ()
4747
return %retval : $()
4848
}

test/SILOptimizer/accesspath_unit.sil

+35-28
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,36 @@ struct S2 {
2020
sil_global hidden @globalKlass : $Klass
2121
sil_global hidden @globalStruct : $S2
2222

23-
// CHECK-LABEL: begin running test 1 of 2 on testRefElement: accesspath-base with: @trace[0]
23+
// CHECK-LABEL: begin running test 1 of 2 on testRefElement: accesspath with: @trace[0]
2424
// CHECK: [[P1:%.*]] = ref_element_addr %0 : $Klass, #Klass.f
2525
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]] : $*S
2626
// CHECK: [[P2:%.*]] = ref_element_addr %0 : $Klass, #Klass.f
2727
// CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]] : $*S
28-
// CHECK: Access path base: [[P1]] = ref_element_addr %0 : $Klass, #Klass.f
28+
// CHECK: Access path for: [[P1]] = ref_element_addr %0 : $Klass, #Klass.f
29+
// CHECK-NEXT: base: [[P1]] = ref_element_addr %0 : $Klass, #Klass.f
2930
// CHECK-NEXT: Exact Use: %{{.*}} = load [trivial] [[A1]] : $*S
3031
// CHECK-NEXT: Exact Use: end_access [[A1]] : $*S
31-
// CHECK: end running test 1 of 2 on testRefElement: accesspath-base with: @trace[0]
32+
// CHECK: end running test 1 of 2 on testRefElement: accesspath with: @trace[0]
3233

33-
// CHECK-LABEL: begin running test 2 of 2 on testRefElement: accesspath-base with: @trace[1]
34+
// CHECK-LABEL: begin running test 2 of 2 on testRefElement: accesspath with: @trace[1]
3435
// CHECK: [[P1:%.*]] = ref_element_addr %0 : $Klass, #Klass.f
3536
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]] : $*S
3637
// CHECK: [[P2:%.*]] = ref_element_addr %0 : $Klass, #Klass.f
3738
// CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]] : $*S
38-
// CHECK: Access path base: [[P2]] = ref_element_addr %0 : $Klass, #Klass.f
39+
// CHECK: Access path for: [[P2]] = ref_element_addr %0 : $Klass, #Klass.f
40+
// CHECK: base: [[P2]] = ref_element_addr %0 : $Klass, #Klass.f
3941
// CHECK-NEXT: Exact Use: %{{.*}} = load [trivial] [[A2]] : $*S
4042
// CHECK-NEXT: Exact Use: end_access [[A2]] : $*S
41-
// CHECK: end running test 2 of 2 on testRefElement: accesspath-base with: @trace[1]
43+
// CHECK: end running test 2 of 2 on testRefElement: accesspath with: @trace[1]
4244
sil hidden [ossa] @testRefElement : $@convention(thin) (@guaranteed Klass) -> () {
4345
bb0(%0 : @guaranteed $Klass):
44-
specify_test "accesspath-base @trace[0]"
46+
specify_test "accesspath @trace[0]"
4547
%p1 = ref_element_addr %0 : $Klass, #Klass.f
4648
debug_value [trace] %p1 : $*S
4749
%a1 = begin_access [read] [dynamic] %p1 : $*S
4850
%l1 = load [trivial] %a1 : $*S
4951
end_access %a1 : $*S
50-
specify_test "accesspath-base @trace[1]"
52+
specify_test "accesspath @trace[1]"
5153
%p2 = ref_element_addr %0 : $Klass, #Klass.f
5254
debug_value [trace] %p2 : $*S
5355
%a2 = begin_access [read] [dynamic] %p2 : $*S
@@ -57,36 +59,38 @@ bb0(%0 : @guaranteed $Klass):
5759
return %99 : $()
5860
}
5961

60-
// CHECK-LABEL: begin running test 1 of 2 on testGlobalAddrKlass: accesspath-base with: @trace[0]
62+
// CHECK-LABEL: begin running test 1 of 2 on testGlobalAddrKlass: accesspath with: @trace[0]
6163
// CHECK: [[P1:%.*]] = global_addr @globalKlass : $*Klass
6264
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]] : $*Klass
6365
// CHECK: [[P2:%.*]] = global_addr @globalKlass : $*Klass
6466
// CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]] : $*Klass
65-
// CHECK: Access path base: [[P1]] = global_addr @globalKlass : $*Klass
67+
// CHECK: Access path for: [[P1]] = global_addr @globalKlass : $*Klass
68+
// CHECK: base: [[P1]] = global_addr @globalKlass : $*Klass
6669
// CHECK-NEXT: Exact Use: %{{.*}} = load_borrow [[A1]]
6770
// CHECK-NEXT: Exact Use: end_access [[A1]]
68-
// CHECK: end running test 1 of 2 on testGlobalAddrKlass: accesspath-base with: @trace[0]
71+
// CHECK: end running test 1 of 2 on testGlobalAddrKlass: accesspath with: @trace[0]
6972

70-
// CHECK-LABEL: begin running test 2 of 2 on testGlobalAddrKlass: accesspath-base with: @trace[1]
73+
// CHECK-LABEL: begin running test 2 of 2 on testGlobalAddrKlass: accesspath with: @trace[1]
7174
// CHECK: [[P1:%.*]] = global_addr @globalKlass : $*Klass
7275
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]] : $*Klass
7376
// CHECK: [[P2:%.*]] = global_addr @globalKlass : $*Klass
7477
// CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]] : $*Klass
75-
// CHECK: Access path base: [[P2]] = global_addr @globalKlass : $*Klass
78+
// CHECK: Access path for: [[P2]] = global_addr @globalKlass : $*Klass
79+
// CHECK: base: [[P2]] = global_addr @globalKlass : $*Klass
7680
// CHECK-NEXT: Exact Use: %{{.*}} = load_borrow [[A2]]
7781
// CHECK-NEXT: Exact Use: end_access [[A2]]
78-
// CHECK: end running test 2 of 2 on testGlobalAddrKlass: accesspath-base with: @trace[1]
82+
// CHECK: end running test 2 of 2 on testGlobalAddrKlass: accesspath with: @trace[1]
7983
sil [ossa] @testGlobalAddrKlass : $@convention(thin) () -> () {
8084
bb0:
81-
specify_test "accesspath-base @trace[0]"
85+
specify_test "accesspath @trace[0]"
8286
%p1 = global_addr @globalKlass : $*Klass
8387
debug_value [trace] %p1 : $*Klass
8488
%a1 = begin_access [read] [dynamic] %p1 : $*Klass
8589
%l1 = load_borrow %a1 : $*Klass
8690
end_borrow %l1 : $Klass
8791
end_access %a1 : $*Klass
8892

89-
specify_test "accesspath-base @trace[1]"
93+
specify_test "accesspath @trace[1]"
9094
%p2 = global_addr @globalKlass : $*Klass
9195
debug_value [trace] %p2 : $*Klass
9296
%a2 = begin_access [read] [dynamic] %p2 : $*Klass
@@ -98,7 +102,7 @@ bb0:
98102
return %9999 : $()
99103
}
100104

101-
// CHECK-LABEL: begin running test 1 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[0]
105+
// CHECK-LABEL: begin running test 1 of 3 on testGlobalAddrStruct: accesspath with: @trace[0]
102106
// CHECK: [[P1:%.*]] = global_addr @globalStruct
103107
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]]
104108
// CHECK: [[P2:%.*]] = global_addr @globalStruct
@@ -107,12 +111,13 @@ bb0:
107111
// CHECK: [[P3:%.*]] = global_addr @globalStruct
108112
// CHECK: [[A3:%.*]] = begin_access [read] [dynamic] [[P3]]
109113
// CHECK: [[GEP3:%.*]] = struct_element_addr [[A3]]
110-
// CHECK: Access path base: [[P1]] = global_addr @globalStruct
114+
// CHECK: Access path for: [[P1]] = global_addr @globalStruct
115+
// CHECK: base: [[P1]] = global_addr @globalStruct
111116
// CHECK-NEXT: Exact Use: %{{.*}} = load_borrow [[A1]]
112117
// CHECK-NEXT: Exact Use: end_access [[A1]]
113-
// CHECK: end running test 1 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[0]
118+
// CHECK: end running test 1 of 3 on testGlobalAddrStruct: accesspath with: @trace[0]
114119

115-
// CHECK-LABEL: begin running test 2 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[1]
120+
// CHECK-LABEL: begin running test 2 of 3 on testGlobalAddrStruct: accesspath with: @trace[1]
116121
// CHECK: [[P1:%.*]] = global_addr @globalStruct
117122
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]]
118123
// CHECK: [[P2:%.*]] = global_addr @globalStruct
@@ -121,12 +126,13 @@ bb0:
121126
// CHECK: [[P3:%.*]] = global_addr @globalStruct
122127
// CHECK: [[A3:%.*]] = begin_access [read] [dynamic] [[P3]]
123128
// CHECK: [[GEP3:%.*]] = struct_element_addr [[A3]]
124-
// CHECK: Access path base: [[P2]] = global_addr @globalStruct
129+
// CHECK: Access path for: [[P2]] = global_addr @globalStruct
130+
// CHECK: base: [[P2]] = global_addr @globalStruct
125131
// CHECK-NEXT: Inner Use: %{{.*}} = load_borrow [[GEP2]]
126132
// CHECK-NEXT: Exact Use: end_access [[A2]]
127-
// CHECK: end running test 2 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[1]
133+
// CHECK: end running test 2 of 3 on testGlobalAddrStruct: accesspath with: @trace[1]
128134

129-
// CHECK-LABEL: begin running test 3 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[2]
135+
// CHECK-LABEL: begin running test 3 of 3 on testGlobalAddrStruct: accesspath with: @trace[2]
130136
// CHECK: [[P1:%.*]] = global_addr @globalStruct
131137
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]]
132138
// CHECK: [[P2:%.*]] = global_addr @globalStruct
@@ -135,21 +141,22 @@ bb0:
135141
// CHECK: [[P3:%.*]] = global_addr @globalStruct
136142
// CHECK: [[A3:%.*]] = begin_access [read] [dynamic] [[P3]]
137143
// CHECK: [[GEP3:%.*]] = struct_element_addr [[A3]]
138-
// CHECK: Access path base: [[P3]] = global_addr @globalStruct
144+
// CHECK: Access path for: [[P3]] = global_addr @globalStruct
145+
// CHECK: base: [[P3]] = global_addr @globalStruct
139146
// CHECK-NEXT: Inner Use: %{{.*}} = load_borrow [[GEP3]]
140147
// CHECK-NEXT: Exact Use: end_access [[A3]]
141-
// CHECK: end running test 3 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[2]
148+
// CHECK: end running test 3 of 3 on testGlobalAddrStruct: accesspath with: @trace[2]
142149
sil [ossa] @testGlobalAddrStruct : $@convention(thin) () -> () {
143150
bb0:
144-
specify_test "accesspath-base @trace[0]"
151+
specify_test "accesspath @trace[0]"
145152
%p3 = global_addr @globalStruct : $*S2
146153
debug_value [trace] %p3 : $*S2
147154
%a3 = begin_access [read] [dynamic] %p3 : $*S2
148155
%l3 = load_borrow %a3 : $*S2
149156
end_borrow %l3 : $S2
150157
end_access %a3 : $*S2
151158

152-
specify_test "accesspath-base @trace[1]"
159+
specify_test "accesspath @trace[1]"
153160
%p4 = global_addr @globalStruct : $*S2
154161
debug_value [trace] %p4 : $*S2
155162
%a4 = begin_access [read] [dynamic] %p4 : $*S2
@@ -158,7 +165,7 @@ bb0:
158165
end_borrow %l4 : $Klass
159166
end_access %a4 : $*S2
160167

161-
specify_test "accesspath-base @trace[2]"
168+
specify_test "accesspath @trace[2]"
162169
%p5 = global_addr @globalStruct : $*S2
163170
debug_value [trace] %p5 : $*S2
164171
%a5 = begin_access [read] [dynamic] %p5 : $*S2

0 commit comments

Comments
 (0)