Skip to content

Commit 604af9a

Browse files
committed
Fix test on 32-bit targets
Fixes rdar://106707727
1 parent 6b0c22c commit 604af9a

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

test/IRGen/variadic_generic_outlining.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct Wrapper<Value> {
1818
// CHECK-NEXT: [[ELT_TYPE:%.*]] = load %swift.type*, %swift.type** [[T0]], align
1919
// Test that we do the copy through the VWT for the element type.
2020
// CHECK: [[T0:%.*]] = bitcast %swift.type* [[ELT_TYPE]] to i8***
21-
// CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds i8**, i8*** [[T0]], i64 -1
21+
// CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds i8**, i8*** [[T0]], [[INT]] -1
2222
sil hidden @test_outlining : $@convention(thin) <each T> (@pack_guaranteed Pack{repeat Wrapper<each T>}) -> @pack_out Pack{repeat Wrapper<each T>} {
2323
bb0(%0 : $*Pack{repeat Wrapper<each T>}, %1 : $*Pack{repeat Wrapper<each T>}):
2424
%zero = integer_literal $Builtin.Word, 0
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// RUN: %target-swift-emit-silgen -enable-experimental-feature VariadicGenerics %s | %FileCheck %s
2+
// REQUIRES: asserts
3+
4+
func mutateInt(_ arg: inout Int) {}
5+
6+
struct Sub {
7+
subscript<each T>(variadic args: repeat each T) -> Int {
8+
get { return 0 }
9+
set {}
10+
}
11+
12+
subscript<each T>(simpleTuple args: (repeat each T)) -> Int {
13+
get { return 0 }
14+
set {}
15+
}
16+
17+
subscript<each T>(compoundTuple args: (String, repeat each T)) -> Int {
18+
get { return 0 }
19+
set {}
20+
}
21+
}
22+
23+
func testVariadic<each T>(sub: inout Sub, args: repeat each T) {
24+
mutateInt(&sub[variadic: repeat each args])
25+
}
26+
27+
func testVariadicWithExtra<each T>(sub: inout Sub, args: repeat each T, extra: String) {
28+
mutateInt(&sub[variadic: repeat each args, extra])
29+
}
30+
31+
func testVariadicConcrete(sub: inout Sub, first: String, second: Int) {
32+
mutateInt(&sub[variadic: first, second])
33+
}
34+
35+
func testSimpleTupleSubscript<each T>(sub: inout Sub, args: repeat each T) {
36+
mutateInt(&sub[simpleTuple: (repeat each args)])
37+
}
38+
39+
func testSimpleTupleWithExtra<each T>(sub: inout Sub, args: repeat each T, extra: String) {
40+
mutateInt(&sub[simpleTuple: (repeat each args, extra)])
41+
}
42+
43+
func testSimpleTupleConcrete(sub: inout Sub, first: String, second: Int) {
44+
mutateInt(&sub[simpleTuple: (first, second)])
45+
}
46+
47+
func testCompoundTupleSubscript<each T>(sub: inout Sub, args: repeat each T, first: String) {
48+
mutateInt(&sub[compoundTuple: (first, repeat each args)])
49+
}
50+
51+
func testCompoundTupleWithExtra<each T>(sub: inout Sub, args: repeat each T, first: String, extra: String) {
52+
mutateInt(&sub[compoundTuple: (first, repeat each args, extra)])
53+
}
54+
55+
func testSimpleTupleConcrete(sub: inout Sub, first: String, second: String, third: Int) {
56+
mutateInt(&sub[compoundTuple: (first, second, third)])
57+
}
58+

0 commit comments

Comments
 (0)