Skip to content

Commit b51e9df

Browse files
authored
Merge pull request #60571 from eeckstein/fix-test
tests: Fix SILOptimizer/accessutils.sil for 32-bit test targets
2 parents 6079452 + a15d59e commit b51e9df

File tree

1 file changed

+75
-63
lines changed

1 file changed

+75
-63
lines changed

test/SILOptimizer/accessutils.sil

Lines changed: 75 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -12,53 +12,53 @@ import Swift
1212
import SwiftShims
1313

1414
class List {
15-
var x: Int
15+
var x: Int64
1616
let next: List
1717
}
1818

1919
struct S {
2020
var l: List
21-
var y: Int
21+
var y: Int64
2222
}
2323

2424
struct Ptr {
2525
var p: Int64
2626
}
2727

2828
// CHECK-LABEL: Accesses for readIdentifiedArg
29-
// CHECK-NEXT: Value: %0 = argument of bb0 : $*Int
29+
// CHECK-NEXT: Value: %0 = argument of bb0 : $*Int64
3030
// CHECK-NEXT: Scope: base
31-
// CHECK-NEXT: Base: argument - %0 = argument of bb0 : $*Int
31+
// CHECK-NEXT: Base: argument - %0 = argument of bb0 : $*Int64
3232
// CHECK-NEXT: Path: ""
33-
// CHECK-NEXT: Storage: %0 = argument of bb0 : $*Int
33+
// CHECK-NEXT: Storage: %0 = argument of bb0 : $*Int64
3434
// CHECK-NEXT: Path: ""
3535
// CHECK-NEXT: End accesses for readIdentifiedArg
36-
sil [ossa] @readIdentifiedArg : $@convention(thin) (@in Int) -> Int {
37-
bb0(%0 : $*Int):
38-
%res = load [trivial] %0 : $*Int
39-
return %res : $Int
36+
sil [ossa] @readIdentifiedArg : $@convention(thin) (@in Int64) -> Int64 {
37+
bb0(%0 : $*Int64):
38+
%res = load [trivial] %0 : $*Int64
39+
return %res : $Int64
4040
}
4141

4242
// CHECK-LABEL: Accesses for writeIdentifiedArg
43-
// CHECK-NEXT: Value: %0 = argument of bb0 : $*Int
43+
// CHECK-NEXT: Value: %0 = argument of bb0 : $*Int64
4444
// CHECK-NEXT: Scope: base
45-
// CHECK-NEXT: Base: argument - %0 = argument of bb0 : $*Int
45+
// CHECK-NEXT: Base: argument - %0 = argument of bb0 : $*Int64
4646
// CHECK-NEXT: Path: ""
47-
// CHECK-NEXT: Storage: %0 = argument of bb0 : $*Int
47+
// CHECK-NEXT: Storage: %0 = argument of bb0 : $*Int64
4848
// CHECK-NEXT: Path: ""
4949
// CHECK-NEXT: End accesses for writeIdentifiedArg
50-
sil [ossa] @writeIdentifiedArg : $@convention(thin) (@inout Int) -> () {
51-
bb0(%0 : $*Int):
50+
sil [ossa] @writeIdentifiedArg : $@convention(thin) (@inout Int64) -> () {
51+
bb0(%0 : $*Int64):
5252
%2 = integer_literal $Builtin.Int64, 42
53-
%3 = struct $Int (%2 : $Builtin.Int64)
54-
store %3 to [trivial] %0 : $*Int
53+
%3 = struct $Int64 (%2 : $Builtin.Int64)
54+
store %3 to [trivial] %0 : $*Int64
5555
%5 = tuple ()
5656
return %5 : $()
5757
}
5858

5959
// CHECK-LABEL: Accesses for $writeToHead
60-
// CHECK-NEXT: Value: %7 = begin_access [modify] [dynamic] %6 : $*Int
61-
// CHECK-NEXT: Scope: %7 = begin_access [modify] [dynamic] %6 : $*Int
60+
// CHECK-NEXT: Value: %7 = begin_access [modify] [dynamic] %6 : $*Int64
61+
// CHECK-NEXT: Scope: %7 = begin_access [modify] [dynamic] %6 : $*Int64
6262
// CHECK-NEXT: Base: class - %6 = ref_element_addr %5 : $List, #List.x
6363
// CHECK-NEXT: Path: ""
6464
// CHECK-NEXT: Storage: %0 = argument of bb0 : $S
@@ -69,26 +69,26 @@ bb0(%0 : @guaranteed $S):
6969
debug_value %0 : $S, let, name "s", argno 1
7070
%2 = struct_extract %0 : $S, #S.l
7171
%3 = integer_literal $Builtin.Int64, 10
72-
%4 = struct $Int (%3 : $Builtin.Int64)
72+
%4 = struct $Int64 (%3 : $Builtin.Int64)
7373
%5 = begin_borrow [lexical] %2 : $List
7474
%6 = ref_element_addr %5 : $List, #List.x
75-
%7 = begin_access [modify] [dynamic] %6 : $*Int
76-
store %4 to [trivial] %7 : $*Int
77-
end_access %7 : $*Int
75+
%7 = begin_access [modify] [dynamic] %6 : $*Int64
76+
store %4 to [trivial] %7 : $*Int64
77+
end_access %7 : $*Int64
7878
end_borrow %5 : $List
7979
%11 = tuple ()
8080
return %11 : $()
8181
}
8282

8383
// CHECK-LABEL: Accesses for storeToArgs
84-
// CHECK-NEXT: Value: %6 = begin_access [modify] [dynamic] %5 : $*Int
85-
// CHECK-NEXT: Scope: %6 = begin_access [modify] [dynamic] %5 : $*Int
84+
// CHECK-NEXT: Value: %6 = begin_access [modify] [dynamic] %5 : $*Int64
85+
// CHECK-NEXT: Scope: %6 = begin_access [modify] [dynamic] %5 : $*Int64
8686
// CHECK-NEXT: Base: class - %5 = ref_element_addr %0 : $List, #List.x
8787
// CHECK-NEXT: Path: ""
8888
// CHECK-NEXT: Storage: %0 = argument of bb0 : $List
8989
// CHECK-NEXT: Path: "c0"
90-
// CHECK-NEXT: Value: %14 = begin_access [modify] [dynamic] %13 : $*Int
91-
// CHECK-NEXT: Scope: %14 = begin_access [modify] [dynamic] %13 : $*Int
90+
// CHECK-NEXT: Value: %14 = begin_access [modify] [dynamic] %13 : $*Int64
91+
// CHECK-NEXT: Scope: %14 = begin_access [modify] [dynamic] %13 : $*Int64
9292
// CHECK-NEXT: Base: class - %13 = ref_element_addr %1 : $List, #List.x
9393
// CHECK-NEXT: Path: ""
9494
// CHECK-NEXT: Storage: %1 = argument of bb0 : $List
@@ -100,21 +100,21 @@ bb0(%1 : @guaranteed $List, %2 : @guaranteed $List):
100100

101101
bb1:
102102
%8 = integer_literal $Builtin.Int64, 10
103-
%9 = struct $Int (%8 : $Builtin.Int64)
103+
%9 = struct $Int64 (%8 : $Builtin.Int64)
104104
%10 = ref_element_addr %1 : $List, #List.x
105-
%11 = begin_access [modify] [dynamic] %10 : $*Int
106-
store %9 to [trivial] %11 : $*Int
107-
end_access %11 : $*Int
105+
%11 = begin_access [modify] [dynamic] %10 : $*Int64
106+
store %9 to [trivial] %11 : $*Int64
107+
end_access %11 : $*Int64
108108
%14 = tuple ()
109109
br bb3
110110

111111
bb2:
112112
%16 = integer_literal $Builtin.Int64, 20
113-
%17 = struct $Int (%16 : $Builtin.Int64)
113+
%17 = struct $Int64 (%16 : $Builtin.Int64)
114114
%18 = ref_element_addr %2 : $List, #List.x
115-
%19 = begin_access [modify] [dynamic] %18 : $*Int
116-
store %17 to [trivial] %19 : $*Int
117-
end_access %19 : $*Int
115+
%19 = begin_access [modify] [dynamic] %18 : $*Int64
116+
store %17 to [trivial] %19 : $*Int64
117+
end_access %19 : $*Int64
118118
%22 = tuple ()
119119
br bb3
120120

@@ -124,8 +124,8 @@ bb3:
124124
}
125125

126126
// CHECK-LABEL: Accesses for storeMaybeLocalPhi
127-
// CHECK-NEXT: Value: %10 = begin_access [modify] [dynamic] %9 : $*Int
128-
// CHECK-NEXT: Scope: %10 = begin_access [modify] [dynamic] %9 : $*Int
127+
// CHECK-NEXT: Value: %10 = begin_access [modify] [dynamic] %9 : $*Int64
128+
// CHECK-NEXT: Scope: %10 = begin_access [modify] [dynamic] %9 : $*Int64
129129
// CHECK-NEXT: Base: class - %9 = ref_element_addr %6 : $List, #List.x
130130
// CHECK-NEXT: Path: ""
131131
// CHECK-NEXT: Storage: %4 = alloc_ref $List
@@ -147,11 +147,11 @@ bb2:
147147

148148
bb3(%12 : $List):
149149
%14 = integer_literal $Builtin.Int64, 20
150-
%15 = struct $Int (%14 : $Builtin.Int64)
150+
%15 = struct $Int64 (%14 : $Builtin.Int64)
151151
%16 = ref_element_addr %12 : $List, #List.x
152-
%17 = begin_access [modify] [dynamic] %16 : $*Int
153-
store %15 to %17 : $*Int
154-
end_access %17 : $*Int
152+
%17 = begin_access [modify] [dynamic] %16 : $*Int64
153+
store %15 to %17 : $*Int64
154+
end_access %17 : $*Int64
155155
%20 = tuple ()
156156
strong_release %12 : $List
157157
%22 = tuple ()
@@ -224,20 +224,20 @@ bb3(%6 : $Builtin.RawPointer) :
224224

225225

226226
// CHECK-LABEL: Accesses for readIdentifiedBoxArg
227-
// CHECK-NEXT: Value: %2 = begin_access [read] [dynamic] %1 : $*Int
228-
// CHECK-NEXT: Scope: %2 = begin_access [read] [dynamic] %1 : $*Int
229-
// CHECK-NEXT: Base: box - %1 = project_box %0 : ${ var Int }, 0
227+
// CHECK-NEXT: Value: %2 = begin_access [read] [dynamic] %1 : $*Int64
228+
// CHECK-NEXT: Scope: %2 = begin_access [read] [dynamic] %1 : $*Int64
229+
// CHECK-NEXT: Base: box - %1 = project_box %0 : ${ var Int64 }, 0
230230
// CHECK-NEXT: Path: ""
231-
// CHECK-NEXT: Storage: %0 = argument of bb0 : ${ var Int }
231+
// CHECK-NEXT: Storage: %0 = argument of bb0 : ${ var Int64 }
232232
// CHECK-NEXT: Path: "c0"
233233
// CHECK-NEXT: End accesses for readIdentifiedBoxArg
234-
sil [ossa] @readIdentifiedBoxArg : $@convention(thin) (@guaranteed { var Int }) -> Int {
235-
bb0(%0 : @guaranteed ${ var Int }):
236-
%1 = project_box %0 : ${ var Int }, 0
237-
%5 = begin_access [read] [dynamic] %1 : $*Int
238-
%6 = load [trivial] %5 : $*Int
239-
end_access %5 : $*Int
240-
return %6 : $Int
234+
sil [ossa] @readIdentifiedBoxArg : $@convention(thin) (@guaranteed { var Int64 }) -> Int64 {
235+
bb0(%0 : @guaranteed ${ var Int64 }):
236+
%1 = project_box %0 : ${ var Int64 }, 0
237+
%5 = begin_access [read] [dynamic] %1 : $*Int64
238+
%6 = load [trivial] %5 : $*Int64
239+
end_access %5 : $*Int64
240+
return %6 : $Int64
241241
}
242242

243243

@@ -274,6 +274,18 @@ bb0(%0 : $Int64):
274274
return %99 : $()
275275
}
276276

277+
struct MySwiftArrayBodyStorage {
278+
@_hasStorage var count : Int64
279+
}
280+
281+
struct MyArrayBody {
282+
@_hasStorage var _storage : MySwiftArrayBodyStorage
283+
}
284+
285+
class MyContiguousArrayStorageBase {
286+
@_hasStorage var countAndCapacity : MyArrayBody
287+
}
288+
277289
struct _MyBridgeStorage {
278290
@_hasStorage var rawValue : Builtin.BridgeObject
279291
}
@@ -288,21 +300,21 @@ struct MyArray<T> {
288300
}
289301

290302
// CHECK-LABEL: Accesses for testRefTailAndStruct0
291-
// CHECK-NEXT: Value: %8 = struct_element_addr %7 : $*Int, #Int._value // user: %9
303+
// CHECK-NEXT: Value: %8 = struct_element_addr %7 : $*Int64, #Int64._value // user: %9
292304
// CHECK-NEXT: Scope: base
293-
// CHECK-NEXT: Base: class - %5 = ref_element_addr [immutable] %4 : $__ContiguousArrayStorageBase, #__ContiguousArrayStorageBase.countAndCapacity
305+
// CHECK-NEXT: Base: class - %5 = ref_element_addr [immutable] %4 : $MyContiguousArrayStorageBase, #MyContiguousArrayStorageBase.countAndCapacity
294306
// CHECK-NEXT: Path: "s0.s0.s0"
295307
// CHECK-NEXT: Storage: %0 = argument of bb0 : $MyArray<String>
296308
// CHECK-NEXT: Path: "s0.s0.s0.c0.s0.s0.s0"
297309
// CHECK-NEXT: Value: %11 = struct_element_addr %10 : $*String, #String._guts
298310
// CHECK-NEXT: Scope: base
299-
// CHECK-NEXT: Base: tail - %10 = ref_tail_addr [immutable] %4 : $__ContiguousArrayStorageBase, $String
311+
// CHECK-NEXT: Base: tail - %10 = ref_tail_addr [immutable] %4 : $MyContiguousArrayStorageBase, $String
300312
// CHECK-NEXT: Path: "s0"
301313
// CHECK-NEXT: Storage: %0 = argument of bb0 : $MyArray<String>
302314
// CHECK-NEXT: Path: "s0.s0.s0.ct.s0"
303-
// CHECK-NEXT: Value: %10 = ref_tail_addr [immutable] %4 : $__ContiguousArrayStorageBase, $String
315+
// CHECK-NEXT: Value: %10 = ref_tail_addr [immutable] %4 : $MyContiguousArrayStorageBase, $String
304316
// CHECK-NEXT: Scope: base
305-
// CHECK-NEXT: Base: tail - %10 = ref_tail_addr [immutable] %4 : $__ContiguousArrayStorageBase, $String
317+
// CHECK-NEXT: Base: tail - %10 = ref_tail_addr [immutable] %4 : $MyContiguousArrayStorageBase, $String
306318
// CHECK-NEXT: Path: ""
307319
// CHECK-NEXT: Storage: %0 = argument of bb0 : $MyArray<String>
308320
// CHECK-NEXT: Path: "s0.s0.s0.ct"
@@ -312,16 +324,16 @@ bb0(%0 : $MyArray<String>):
312324
%1 = struct_extract %0 : $MyArray<String>, #MyArray._buffer
313325
%2 = struct_extract %1 : $_MyArrayBuffer<String>, #_MyArrayBuffer._storage
314326
%3 = struct_extract %2 : $_MyBridgeStorage, #_MyBridgeStorage.rawValue
315-
%4 = unchecked_ref_cast %3 : $Builtin.BridgeObject to $__ContiguousArrayStorageBase
316-
%5 = ref_element_addr [immutable] %4 : $__ContiguousArrayStorageBase, #__ContiguousArrayStorageBase.countAndCapacity
317-
%6 = struct_element_addr %5 : $*_ArrayBody, #_ArrayBody._storage
318-
%7 = struct_element_addr %6 : $*_SwiftArrayBodyStorage, #_SwiftArrayBodyStorage.count
319-
%8 = struct_element_addr %7 : $*Int, #Int._value
327+
%4 = unchecked_ref_cast %3 : $Builtin.BridgeObject to $MyContiguousArrayStorageBase
328+
%5 = ref_element_addr [immutable] %4 : $MyContiguousArrayStorageBase, #MyContiguousArrayStorageBase.countAndCapacity
329+
%6 = struct_element_addr %5 : $*MyArrayBody, #MyArrayBody._storage
330+
%7 = struct_element_addr %6 : $*MySwiftArrayBodyStorage, #MySwiftArrayBodyStorage.count
331+
%8 = struct_element_addr %7 : $*Int64, #Int64._value
320332
%9 = load %8 : $*Builtin.Int64
321-
%10 = ref_tail_addr [immutable] %4 : $__ContiguousArrayStorageBase, $String
333+
%10 = ref_tail_addr [immutable] %4 : $MyContiguousArrayStorageBase, $String
322334
%11 = struct_element_addr %10 : $*String, #String._guts
323335
%12 = load %11 : $*_StringGuts
324336
%13 = load %10 : $*String
325337
%14 = tuple ()
326338
return %14 : $()
327-
}
339+
}

0 commit comments

Comments
 (0)