Rename accesspath unit test.

If was called accesspath-base, but it's primarily about the uses of the accesspath, not the base. Very confusing.
This commit is contained in:
Andrew Trick
2024-05-13 17:13:59 -07:00
parent 57a5ab8a29
commit c35ce8302b
3 changed files with 44 additions and 36 deletions

View File

@@ -2087,13 +2087,14 @@ struct AccessUseTestVisitor : public AccessUseVisitor {
}
};
static FunctionTest AccessPathBaseTest("accesspath-base", [](auto &function,
auto &arguments,
auto &test) {
static FunctionTest AccessPathBaseTest("accesspath", [](auto &function,
auto &arguments,
auto &test) {
auto value = arguments.takeValue();
function.print(llvm::outs());
llvm::outs() << "Access path base: " << value;
llvm::outs() << "Access path for: " << value;
auto accessPathWithBase = AccessPathWithBase::compute(value);
llvm::outs() << " base: " << accessPathWithBase.base;
AccessUseTestVisitor visitor;
visitAccessPathBaseUses(visitor, accessPathWithBase, &function);
});

View File

@@ -27,10 +27,10 @@ class C {}
// CHECK: Class [[BOX]] = argument of bb0
// CHECK: Field: var value: T Index: 0
// CHECK-LABEL: end running test {{.*}} on test_phi_nested_access: compute_access_storage with
// CHECK-LABEL: begin running test 3 of 3 on test_phi_nested_access: accesspath-base
// CHECK: Access path base: %6 = argument of bb1
// CHECK-LABEL: begin running test 3 of 3 on test_phi_nested_access: accesspath
// CHECK: Access path for: %6 = argument of bb1
// CHECK: Exact Use: end_access %2
// CHECK-LABEL: end running test 3 of 3 on test_phi_nested_access: accesspath-base
// CHECK-LABEL: end running test 3 of 3 on test_phi_nested_access: accesspath
sil @test_phi_nested_access : $@convention(method) (@guaranteed Box<C>) -> () {
bb1(%box : $Box<C>):
%value_addr = ref_element_addr %box : $Box<C>, #Box.value
@@ -42,7 +42,7 @@ bb1(%box : $Box<C>):
exit(%phi : $Builtin.RawPointer):
specify_test "get_access_base @argument"
specify_test "compute_access_storage @argument"
specify_test "accesspath-base @argument"
specify_test "accesspath @argument"
%retval = tuple ()
return %retval : $()
}

View File

@@ -20,34 +20,36 @@ struct S2 {
sil_global hidden @globalKlass : $Klass
sil_global hidden @globalStruct : $S2
// CHECK-LABEL: begin running test 1 of 2 on testRefElement: accesspath-base with: @trace[0]
// CHECK-LABEL: begin running test 1 of 2 on testRefElement: accesspath with: @trace[0]
// CHECK: [[P1:%.*]] = ref_element_addr %0 : $Klass, #Klass.f
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]] : $*S
// CHECK: [[P2:%.*]] = ref_element_addr %0 : $Klass, #Klass.f
// CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]] : $*S
// CHECK: Access path base: [[P1]] = ref_element_addr %0 : $Klass, #Klass.f
// CHECK: Access path for: [[P1]] = ref_element_addr %0 : $Klass, #Klass.f
// CHECK-NEXT: base: [[P1]] = ref_element_addr %0 : $Klass, #Klass.f
// CHECK-NEXT: Exact Use: %{{.*}} = load [trivial] [[A1]] : $*S
// CHECK-NEXT: Exact Use: end_access [[A1]] : $*S
// CHECK: end running test 1 of 2 on testRefElement: accesspath-base with: @trace[0]
// CHECK: end running test 1 of 2 on testRefElement: accesspath with: @trace[0]
// CHECK-LABEL: begin running test 2 of 2 on testRefElement: accesspath-base with: @trace[1]
// CHECK-LABEL: begin running test 2 of 2 on testRefElement: accesspath with: @trace[1]
// CHECK: [[P1:%.*]] = ref_element_addr %0 : $Klass, #Klass.f
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]] : $*S
// CHECK: [[P2:%.*]] = ref_element_addr %0 : $Klass, #Klass.f
// CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]] : $*S
// CHECK: Access path base: [[P2]] = ref_element_addr %0 : $Klass, #Klass.f
// CHECK: Access path for: [[P2]] = ref_element_addr %0 : $Klass, #Klass.f
// CHECK: base: [[P2]] = ref_element_addr %0 : $Klass, #Klass.f
// CHECK-NEXT: Exact Use: %{{.*}} = load [trivial] [[A2]] : $*S
// CHECK-NEXT: Exact Use: end_access [[A2]] : $*S
// CHECK: end running test 2 of 2 on testRefElement: accesspath-base with: @trace[1]
// CHECK: end running test 2 of 2 on testRefElement: accesspath with: @trace[1]
sil hidden [ossa] @testRefElement : $@convention(thin) (@guaranteed Klass) -> () {
bb0(%0 : @guaranteed $Klass):
specify_test "accesspath-base @trace[0]"
specify_test "accesspath @trace[0]"
%p1 = ref_element_addr %0 : $Klass, #Klass.f
debug_value [trace] %p1 : $*S
%a1 = begin_access [read] [dynamic] %p1 : $*S
%l1 = load [trivial] %a1 : $*S
end_access %a1 : $*S
specify_test "accesspath-base @trace[1]"
specify_test "accesspath @trace[1]"
%p2 = ref_element_addr %0 : $Klass, #Klass.f
debug_value [trace] %p2 : $*S
%a2 = begin_access [read] [dynamic] %p2 : $*S
@@ -57,28 +59,30 @@ bb0(%0 : @guaranteed $Klass):
return %99 : $()
}
// CHECK-LABEL: begin running test 1 of 2 on testGlobalAddrKlass: accesspath-base with: @trace[0]
// CHECK-LABEL: begin running test 1 of 2 on testGlobalAddrKlass: accesspath with: @trace[0]
// CHECK: [[P1:%.*]] = global_addr @globalKlass : $*Klass
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]] : $*Klass
// CHECK: [[P2:%.*]] = global_addr @globalKlass : $*Klass
// CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]] : $*Klass
// CHECK: Access path base: [[P1]] = global_addr @globalKlass : $*Klass
// CHECK: Access path for: [[P1]] = global_addr @globalKlass : $*Klass
// CHECK: base: [[P1]] = global_addr @globalKlass : $*Klass
// CHECK-NEXT: Exact Use: %{{.*}} = load_borrow [[A1]]
// CHECK-NEXT: Exact Use: end_access [[A1]]
// CHECK: end running test 1 of 2 on testGlobalAddrKlass: accesspath-base with: @trace[0]
// CHECK: end running test 1 of 2 on testGlobalAddrKlass: accesspath with: @trace[0]
// CHECK-LABEL: begin running test 2 of 2 on testGlobalAddrKlass: accesspath-base with: @trace[1]
// CHECK-LABEL: begin running test 2 of 2 on testGlobalAddrKlass: accesspath with: @trace[1]
// CHECK: [[P1:%.*]] = global_addr @globalKlass : $*Klass
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]] : $*Klass
// CHECK: [[P2:%.*]] = global_addr @globalKlass : $*Klass
// CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]] : $*Klass
// CHECK: Access path base: [[P2]] = global_addr @globalKlass : $*Klass
// CHECK: Access path for: [[P2]] = global_addr @globalKlass : $*Klass
// CHECK: base: [[P2]] = global_addr @globalKlass : $*Klass
// CHECK-NEXT: Exact Use: %{{.*}} = load_borrow [[A2]]
// CHECK-NEXT: Exact Use: end_access [[A2]]
// CHECK: end running test 2 of 2 on testGlobalAddrKlass: accesspath-base with: @trace[1]
// CHECK: end running test 2 of 2 on testGlobalAddrKlass: accesspath with: @trace[1]
sil [ossa] @testGlobalAddrKlass : $@convention(thin) () -> () {
bb0:
specify_test "accesspath-base @trace[0]"
specify_test "accesspath @trace[0]"
%p1 = global_addr @globalKlass : $*Klass
debug_value [trace] %p1 : $*Klass
%a1 = begin_access [read] [dynamic] %p1 : $*Klass
@@ -86,7 +90,7 @@ bb0:
end_borrow %l1 : $Klass
end_access %a1 : $*Klass
specify_test "accesspath-base @trace[1]"
specify_test "accesspath @trace[1]"
%p2 = global_addr @globalKlass : $*Klass
debug_value [trace] %p2 : $*Klass
%a2 = begin_access [read] [dynamic] %p2 : $*Klass
@@ -98,7 +102,7 @@ bb0:
return %9999 : $()
}
// CHECK-LABEL: begin running test 1 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[0]
// CHECK-LABEL: begin running test 1 of 3 on testGlobalAddrStruct: accesspath with: @trace[0]
// CHECK: [[P1:%.*]] = global_addr @globalStruct
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]]
// CHECK: [[P2:%.*]] = global_addr @globalStruct
@@ -107,12 +111,13 @@ bb0:
// CHECK: [[P3:%.*]] = global_addr @globalStruct
// CHECK: [[A3:%.*]] = begin_access [read] [dynamic] [[P3]]
// CHECK: [[GEP3:%.*]] = struct_element_addr [[A3]]
// CHECK: Access path base: [[P1]] = global_addr @globalStruct
// CHECK: Access path for: [[P1]] = global_addr @globalStruct
// CHECK: base: [[P1]] = global_addr @globalStruct
// CHECK-NEXT: Exact Use: %{{.*}} = load_borrow [[A1]]
// CHECK-NEXT: Exact Use: end_access [[A1]]
// CHECK: end running test 1 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[0]
// CHECK: end running test 1 of 3 on testGlobalAddrStruct: accesspath with: @trace[0]
// CHECK-LABEL: begin running test 2 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[1]
// CHECK-LABEL: begin running test 2 of 3 on testGlobalAddrStruct: accesspath with: @trace[1]
// CHECK: [[P1:%.*]] = global_addr @globalStruct
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]]
// CHECK: [[P2:%.*]] = global_addr @globalStruct
@@ -121,12 +126,13 @@ bb0:
// CHECK: [[P3:%.*]] = global_addr @globalStruct
// CHECK: [[A3:%.*]] = begin_access [read] [dynamic] [[P3]]
// CHECK: [[GEP3:%.*]] = struct_element_addr [[A3]]
// CHECK: Access path base: [[P2]] = global_addr @globalStruct
// CHECK: Access path for: [[P2]] = global_addr @globalStruct
// CHECK: base: [[P2]] = global_addr @globalStruct
// CHECK-NEXT: Inner Use: %{{.*}} = load_borrow [[GEP2]]
// CHECK-NEXT: Exact Use: end_access [[A2]]
// CHECK: end running test 2 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[1]
// CHECK: end running test 2 of 3 on testGlobalAddrStruct: accesspath with: @trace[1]
// CHECK-LABEL: begin running test 3 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[2]
// CHECK-LABEL: begin running test 3 of 3 on testGlobalAddrStruct: accesspath with: @trace[2]
// CHECK: [[P1:%.*]] = global_addr @globalStruct
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]]
// CHECK: [[P2:%.*]] = global_addr @globalStruct
@@ -135,13 +141,14 @@ bb0:
// CHECK: [[P3:%.*]] = global_addr @globalStruct
// CHECK: [[A3:%.*]] = begin_access [read] [dynamic] [[P3]]
// CHECK: [[GEP3:%.*]] = struct_element_addr [[A3]]
// CHECK: Access path base: [[P3]] = global_addr @globalStruct
// CHECK: Access path for: [[P3]] = global_addr @globalStruct
// CHECK: base: [[P3]] = global_addr @globalStruct
// CHECK-NEXT: Inner Use: %{{.*}} = load_borrow [[GEP3]]
// CHECK-NEXT: Exact Use: end_access [[A3]]
// CHECK: end running test 3 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[2]
// CHECK: end running test 3 of 3 on testGlobalAddrStruct: accesspath with: @trace[2]
sil [ossa] @testGlobalAddrStruct : $@convention(thin) () -> () {
bb0:
specify_test "accesspath-base @trace[0]"
specify_test "accesspath @trace[0]"
%p3 = global_addr @globalStruct : $*S2
debug_value [trace] %p3 : $*S2
%a3 = begin_access [read] [dynamic] %p3 : $*S2
@@ -149,7 +156,7 @@ bb0:
end_borrow %l3 : $S2
end_access %a3 : $*S2
specify_test "accesspath-base @trace[1]"
specify_test "accesspath @trace[1]"
%p4 = global_addr @globalStruct : $*S2
debug_value [trace] %p4 : $*S2
%a4 = begin_access [read] [dynamic] %p4 : $*S2
@@ -158,7 +165,7 @@ bb0:
end_borrow %l4 : $Klass
end_access %a4 : $*S2
specify_test "accesspath-base @trace[2]"
specify_test "accesspath @trace[2]"
%p5 = global_addr @globalStruct : $*S2
debug_value [trace] %p5 : $*S2
%a5 = begin_access [read] [dynamic] %p5 : $*S2