Skip to content

Commit bc40133

Browse files
committed
---
yaml --- r: 345085 b: refs/heads/master c: 05dde68 h: refs/heads/master i: 345083: bd0ea6b
1 parent 0ec6d5d commit bc40133

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 08f22cc2f1f6742e4eae4cd7febea1ba5a226174
2+
refs/heads/master: 05dde68ce94930060c0c46537923c980acb69bdb
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/test/SILOptimizer/access_marker_verify.swift

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -445,28 +445,36 @@ func testEnumLValue(s: inout StructOfEnum) {
445445
enumLValueHelper(&s.e, &s.f)
446446
}
447447

448+
struct MyDict<K: Hashable, V> {
449+
let s = "" // make this non-trivial
450+
subscript(key: K) -> V? {
451+
get { return nil }
452+
set {}
453+
}
454+
}
455+
448456
// --- Optional access.
449-
func accessOptionalArray(_ dict : [Int : [Int]] = [:]) {
457+
func accessOptionalArray(_ dict : MyDict<Int, [Int]>) {
450458
var dict = dict
451459
dict[1]?.append(2)
452460
}
453-
// CHECK-LABEL: sil hidden @$S20access_marker_verify0A13OptionalArrayyySDySiSaySiGGF : $@convention(thin) (@guaranteed Dictionary<Int, Array<Int>>) -> () {
454-
// CHECK: bb0(%0 : @guaranteed $Dictionary<Int, Array<Int>>):
455-
// CHECK: alloc_box ${ var Dictionary<Int, Array<Int>> }, var, name "dict"
461+
// CHECK-LABEL: sil hidden @$S20access_marker_verify0A13OptionalArrayyyAA6MyDictVySiSaySiGGF : $@convention(thin) (@guaranteed MyDict<Int, Array<Int>>) -> () {
462+
// CHECK: bb0(%0 : @guaranteed $MyDict<Int, Array<Int>>):
463+
// CHECK: alloc_box ${ var MyDict<Int, Array<Int>> }, var, name "dict"
456464
// CHECK: [[PROJ:%.*]] = project_box
457465
// ----- initialize the box.
458466
// CHECK: [[INITACCESS:%.*]] = begin_access [modify] [unsafe] [[PROJ]]
459467
// CHECK: store %{{.*}} to [init] [[INITACCESS]]
460468
// CHECK: end_access [[INITACCESS]]
461-
// ----- begin formal access for Dictionary.subscript.setter
469+
// ----- begin formal access for MyDict.subscript.setter
462470
// CHECK: [[BOXACCESS:%.*]] = begin_access [modify] [unknown] [[PROJ]]
463471
// CHECK: [[TEMP:%.*]] = alloc_stack $Optional<Array<Int>>
464-
// CHECK: load_borrow [[BOXACCESS]] : $*Dictionary<Int, Array<Int>>
472+
// CHECK: load_borrow [[BOXACCESS]] : $*MyDict<Int, Array<Int>>
465473
// ----- Initialize some trivial temporaries.
466474
// CHECK: alloc_stack $Int
467475
// CHECK-NOT: begin_access
468476
// CHECK: store %{{.*}} to [trivial]
469-
// ----- Call Dictionary.subscript.getter.
477+
// ----- Call MyDict.subscript.getter.
470478
// CHECK-NOT: begin_access
471479
// CHECK: apply %{{.*}}<Int, [Int]>
472480
// ----- access the temporary array result of the getter
@@ -482,10 +490,10 @@ func accessOptionalArray(_ dict : [Int : [Int]] = [:]) {
482490
// CHECK: [[TEMP3:%.*]] = alloc_stack $Int
483491
// CHECK-NOT: begin_access
484492
// CHECK: store %{{.*}} to [trivial] [[TEMP3]] : $*Int
485-
// Call Dictionary.subscript.setter
486-
// CHECK: apply %{{.*}}<Int, [Int]>([[WRITEBACK]], [[TEMP3]], [[BOXACCESS]]) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Hashable> (@in Optional<τ_0_1>, @in τ_0_0, @inout Dictionary<τ_0_0, τ_0_1>) -> ()
493+
// Call MyDict.subscript.setter
494+
// CHECK: apply %{{.*}}<Int, [Int]>([[WRITEBACK]], [[TEMP3]], [[BOXACCESS]]) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Hashable> (@in Optional<τ_0_1>, @in τ_0_0, @inout MyDict<τ_0_0, τ_0_1>) -> ()
487495
// CHECK: end_access [[TEMPACCESS]] : $*Optional<Array<Int>>
488-
// CHECK: end_access [[BOXACCESS]] : $*Dictionary<Int, Array<Int>>
496+
// CHECK: end_access [[BOXACCESS]] : $*MyDict<Int, Array<Int>>
489497
// CHECK: br
490498
//
491499
// CHECK: bb2:
@@ -501,9 +509,9 @@ func accessOptionalArray(_ dict : [Int : [Int]] = [:]) {
501509
// CHECK: store [[TEMPARRAYVAL]] to [init] [[ARRAYCOPY]] : $*Optional<Array<Int>>
502510
// CHECK: alloc_stack $Int
503511
// CHECK: store %{{.*}} to [trivial]
504-
// ----- call Dictionary.subscript.setter
505-
// CHECK: apply %{{.*}}<Int, [Int]>([[ARRAYCOPY]], %{{.*}}, [[BOXACCESS]]) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Hashable> (@in Optional<τ_0_1>, @in τ_0_0, @inout Dictionary<τ_0_0, τ_0_1>) -> ()
506-
// CHECK-LABEL: } // end sil function '$S20access_marker_verify0A13OptionalArrayyySDySiSaySiGGF'
512+
// ----- call MyDict.subscript.setter
513+
// CHECK: apply %{{.*}}<Int, [Int]>([[ARRAYCOPY]], %{{.*}}, [[BOXACCESS]]) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Hashable> (@in Optional<τ_0_1>, @in τ_0_0, @inout MyDict<τ_0_0, τ_0_1>) -> ()
514+
// CHECK-LABEL: } // end sil function '$S20access_marker_verify0A13OptionalArrayyyAA6MyDictVySiSaySiGGF'
507515

508516
// --- Optional map.
509517
enum OptionalWithMap<Wrapped> {

0 commit comments

Comments
 (0)