Skip to content

Commit 8cb2caa

Browse files
committed
tests: remove unneeded SIL comments and fix check-lines in alias-analysis tests
*) remove `// users: ...` comments *) replace some `CHECK:` with `CHECK-NEXT:` lines. Otherwise the test could pass although the result is wrong
1 parent 6cfec91 commit 8cb2caa

File tree

3 files changed

+43
-43
lines changed

3 files changed

+43
-43
lines changed

test/SILOptimizer/alias-analysis.sil

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ struct OuterStruct {
2222

2323
// Test overlapping access on a different path; the user has misused an index offset
2424
// CHECK-LABEL: @testOffsetBehindProjection
25-
// CHECK: PAIR #23.
26-
// CHECK: %3 = index_addr %1 : $*Int64, %2 : $Builtin.Word
27-
// CHECK: %5 = struct_element_addr %0 : $*MyStruct, #MyStruct.j
28-
// CHECK: NoAlias
25+
// CHECK: PAIR #23.
26+
// CHECK-NEXT: %3 = index_addr %1 : $*Int64, %2 : $Builtin.Word
27+
// CHECK-NEXT: %5 = struct_element_addr %0 : $*MyStruct, #MyStruct.j
28+
// CHECK-NEXT: NoAlias
2929
sil shared @testOffsetBehindProjection : $@convention(thin) (@inout MyStruct) -> () {
3030
bb0(%0 : $*MyStruct):
3131
%1 = struct_element_addr %0 : $*MyStruct, #MyStruct.i
@@ -40,10 +40,10 @@ bb0(%0 : $*MyStruct):
4040
}
4141

4242
// CHECK-LABEL: @testOffsetsBehindProjectionOverlap
43-
// CHECK: PAIR #21.
44-
// CHECK: %2 = struct_element_addr %1 : $*MyStruct, #MyStruct.i
45-
// CHECK: %6 = struct_element_addr %5 : $*MyStruct, #MyStruct.i
46-
// CHECK: NoAlias
43+
// CHECK: PAIR #21.
44+
// CHECK-NEXT: %2 = struct_element_addr %1 : $*MyStruct, #MyStruct.i
45+
// CHECK-NEXT: %6 = struct_element_addr %5 : $*MyStruct, #MyStruct.i
46+
// CHECK-NEXT: NoAlias
4747
sil shared @testOffsetsBehindProjectionOverlap : $@convention(thin) (@inout OuterStruct) -> () {
4848
bb0(%0 : $*OuterStruct):
4949
%1 = struct_element_addr %0 : $*OuterStruct, #OuterStruct.s
@@ -81,14 +81,14 @@ bb0(%0 : $*MyStruct):
8181
}
8282

8383
// CHECK-LABEL: @testUnknownIndex
84-
// CHECK: PAIR #12.
85-
// CHECK: %2 = struct_element_addr %0 : $*MyStruct, #MyStruct.i
86-
// CHECK: %3 = index_addr %0 : $*MyStruct, %1 : $Builtin.Word
87-
// CHECK: MayAlias
88-
// CHECK: PAIR #13.
89-
// CHECK: %2 = struct_element_addr %0 : $*MyStruct, #MyStruct.i
90-
// CHECK: %4 = struct_element_addr %3 : $*MyStruct, #MyStruct.i
91-
// CHECK: MayAlias
84+
// CHECK: PAIR #12.
85+
// CHECK-NEXT: %2 = struct_element_addr %0 : $*MyStruct, #MyStruct.i
86+
// CHECK-NEXT: %3 = index_addr %0 : $*MyStruct, %1 : $Builtin.Word
87+
// CHECK-NEXT: MayAlias
88+
// CHECK: PAIR #13.
89+
// CHECK-NEXT: %2 = struct_element_addr %0 : $*MyStruct, #MyStruct.i
90+
// CHECK-NEXT: %4 = struct_element_addr %3 : $*MyStruct, #MyStruct.i
91+
// CHECK-NEXT: MayAlias
9292
sil @testUnknownIndex : $@convention(thin) (@inout MyStruct, Builtin.Word) -> () {
9393
bb0(%0 : $*MyStruct, %1 : $Builtin.Word):
9494
%2 = struct_element_addr %0 : $*MyStruct, #MyStruct.i

test/SILOptimizer/basic-aa.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ bb0(%0 : $X):
520520

521521
// CHECK-LABEL: @alloc_stack_and_addr_cast
522522
// CHECK: PAIR #1.
523-
// CHECK-NEXT: %0 = alloc_stack $C{{.*}} // users: %2, %1
523+
// CHECK-NEXT: %0 = alloc_stack $C{{.*}}
524524
// CHECK-NEXT: %1 = unchecked_addr_cast %0 : $*C to $*Optional<C>
525525
// CHECK-NEXT: MayAlias
526526
sil @alloc_stack_and_addr_cast : $@convention(thin) () -> () {

test/SILOptimizer/mem-behavior.sil

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ bb0(%0 : $Int32, %1 : $*Int32, %2 : $*Int32):
8989
// CHECK-LABEL: @call_store_to_int_not_aliased
9090
// CHECK: PAIR #0.
9191
// CHECK-NEXT: %4 = apply %3(%0, %1) : $@convention(thin) (Int32, @inout Int32) -> ()
92-
// CHECK-NEXT: %1 = argument of bb0 : $*Int32{{.*}} // user: %4
92+
// CHECK-NEXT: %1 = argument of bb0 : $*Int32{{.*}}
9393
// CHECK-NEXT: r=0,w=1
9494
// CHECK: PAIR #1.
9595
// CHECK-NEXT: %4 = apply %3(%0, %1) : $@convention(thin) (Int32, @inout Int32) -> ()
@@ -107,7 +107,7 @@ bb0(%0 : $Int32, %1 : $*Int32, %2 : $*Int32):
107107
// CHECK-LABEL: @call_store_to_int_aliased
108108
// CHECK: PAIR #0.
109109
// CHECK-NEXT: %6 = apply %5(%0, %3) : $@convention(thin) (Int32, @inout Int32) -> ()
110-
// CHECK-NEXT: %3 = ref_element_addr %1 : $X, #X.a{{.*}} // user: %6
110+
// CHECK-NEXT: %3 = ref_element_addr %1 : $X, #X.a{{.*}}
111111
// CHECK-NEXT: r=0,w=1
112112
// CHECK: PAIR #1.
113113
// CHECK-NEXT: %6 = apply %5(%0, %3) : $@convention(thin) (Int32, @inout Int32) -> ()
@@ -184,15 +184,15 @@ bb0(%0 : $X, %1 : $X):
184184
// CHECK-LABEL: @allocstack_apply_no_side_effect
185185
// CHECK: PAIR #0
186186
// CHECK-NEXT: %3 = apply %2() : $@convention(thin) () -> ()
187-
// CHECK-NEXT: %1 = alloc_stack $Int32{{.*}} // user: %5
187+
// CHECK-NEXT: %1 = alloc_stack $Int32{{.*}}
188188
// CHECK-NEXT: r=0,w=0
189189
sil @allocstack_apply_no_side_effect : $@convention(thin) (Int32) -> () {
190190
bb0(%0 : $Int32):
191-
%1 = alloc_stack $Int32 // user: %5
192-
%2 = function_ref @nouser_func : $@convention(thin) () -> () // user: %3
191+
%1 = alloc_stack $Int32
192+
%2 = function_ref @nouser_func : $@convention(thin) () -> ()
193193
%3 = apply %2() : $@convention(thin) () -> ()
194-
%4 = tuple () // user: %6
195-
dealloc_stack %1 : $*Int32 // id: %5
194+
%4 = tuple ()
195+
dealloc_stack %1 : $*Int32
196196
return %4 : $()
197197
}
198198

@@ -203,30 +203,30 @@ bb0(%0 : $Int32):
203203
// CHECK-NEXT: r=0,w=1
204204
sil @allocstack_apply_side_effect : $@convention(thin) (Int32) -> () {
205205
bb0(%0 : $Int32):
206-
%1 = alloc_stack $Int32 // users: %3, %5
206+
%1 = alloc_stack $Int32
207207
// function_ref store_to_int
208-
%2 = function_ref @store_to_int : $@convention(thin) (Int32, @inout Int32) -> () // user: %3
208+
%2 = function_ref @store_to_int : $@convention(thin) (Int32, @inout Int32) -> ()
209209
%3 = apply %2(%0, %1) : $@convention(thin) (Int32, @inout Int32) -> ()
210-
%4 = tuple () // user: %6
211-
dealloc_stack %1 : $*Int32 // id: %5
212-
return %4 : $() // id: %6
210+
%4 = tuple ()
211+
dealloc_stack %1 : $*Int32
212+
return %4 : $()
213213
}
214214

215215
// CHECK-LABEL: @allocstack_apply_no_escaping
216216
// CHECK: PAIR #0.
217217
// CHECK-NEXT: %3 = apply %2() : $@convention(thin) () -> ()
218-
// CHECK-NEXT: %1 = alloc_stack $Int32{{.*}} // users: %7, %5
218+
// CHECK-NEXT: %1 = alloc_stack $Int32{{.*}}
219219
// CHECK-NEXT: r=0,w=0
220220
sil @allocstack_apply_no_escaping : $@convention(thin) (Int32) -> () {
221221
bb0(%0 : $Int32):
222-
%1 = alloc_stack $Int32 // users: %3, %5
223-
%2 = function_ref @nouser_func : $@convention(thin) () -> () // user: %3
222+
%1 = alloc_stack $Int32
223+
%2 = function_ref @nouser_func : $@convention(thin) () -> ()
224224
%3 = apply %2() : $@convention(thin) () -> ()
225-
%4 = function_ref @store_to_int: $@convention(thin) (Int32, @inout Int32) -> () // user: %3
225+
%4 = function_ref @store_to_int: $@convention(thin) (Int32, @inout Int32) -> ()
226226
%5 = apply %4(%0, %1) : $@convention(thin) (Int32, @inout Int32) -> ()
227-
%6 = tuple () // user: %6
228-
dealloc_stack %1 : $*Int32 // id: %5
229-
return %6 : $() // id: %6
227+
%6 = tuple ()
228+
dealloc_stack %1 : $*Int32
229+
return %6 : $()
230230
}
231231

232232
// CHECK-LABEL: @allocstack_apply_read_only
@@ -303,8 +303,8 @@ bb0(%0 : $*Int32):
303303

304304
// CHECK-LABEL: @escaping_allocstack_to_known_function
305305
// CHECK: PAIR #2.
306-
// CHECK-NEXT: %5 = apply %4(%3) : $@convention(thin) (Builtin.RawPointer) -> UInt8 // user: %7
307-
// CHECK-NEXT: %1 = alloc_stack $UInt8 // users: %6, %3, %2
306+
// CHECK-NEXT: %5 = apply %4(%3) : $@convention(thin) (Builtin.RawPointer) -> UInt8
307+
// CHECK-NEXT: %1 = alloc_stack $UInt8
308308
// CHECK-NEXT: r=1,w=0
309309
sil @escaping_allocstack_to_known_function : $@convention(thin) (UInt8) -> UInt8 {
310310
bb0(%0 : $UInt8):
@@ -836,7 +836,7 @@ sil hidden @testGlobalLet : $@convention(thin) () -> () {
836836
bb0:
837837
%0 = global_addr @globalC : $*C
838838
%1 = load %0 : $*C
839-
%2 = function_ref @nouser_func : $@convention(thin) () -> () // user: %3
839+
%2 = function_ref @nouser_func : $@convention(thin) () -> ()
840840
%3 = apply %2() : $@convention(thin) () -> ()
841841
%8 = tuple ()
842842
return %8 : $()
@@ -851,7 +851,7 @@ sil hidden @testGlobalVar : $@convention(thin) () -> () {
851851
bb0:
852852
%0 = global_addr @globalCVar : $*C
853853
%1 = load %0 : $*C
854-
%2 = function_ref @nouser_func : $@convention(thin) () -> () // user: %3
854+
%2 = function_ref @nouser_func : $@convention(thin) () -> ()
855855
%3 = apply %2() : $@convention(thin) () -> ()
856856
%8 = tuple ()
857857
return %8 : $()
@@ -890,8 +890,8 @@ struct Int64Wrapper {
890890

891891
// CHECK-LABEL: @testNestedAccessWithInterposedProjection
892892
// CHECK: PAIR #2.
893-
// CHECK-NEXT: %1 = begin_access [modify] [static] %0 : $*Int64Wrapper // users: %7, %2
894-
// CHECK-NEXT: %3 = begin_access [read] [static] %2 : $*Int64 // users: %6, %4
893+
// CHECK-NEXT: %1 = begin_access [modify] [static] %0 : $*Int64Wrapper
894+
// CHECK-NEXT: %3 = begin_access [read] [static] %2 : $*Int64
895895
// CHECK-NEXT: r=1,w=1
896896
sil @testNestedAccessWithInterposedProjection : $@convention(thin) (@inout Int64Wrapper) -> () {
897897
bb0(%0 : $*Int64Wrapper):
@@ -1246,7 +1246,7 @@ bb0:
12461246
// CHECK-LABEL: @test_stored_pointer
12471247
// CHECK: PAIR #3.
12481248
// CHECK-NEXT: %5 = apply %4(%2) : $@convention(thin) (@in Builtin.RawPointer) -> ()
1249-
// CHECK-NEXT: %0 = alloc_stack $Int // users: %7, %1
1249+
// CHECK-NEXT: %0 = alloc_stack $Int
12501250
// CHECK-NEXT: r=1,w=1
12511251
sil @test_stored_pointer : $@convention(thin) () -> () {
12521252
bb0:

0 commit comments

Comments
 (0)