Skip to content

Commit 404a69d

Browse files
Merge pull request #68221 from nate-chandler/cherrypick/release/5.9.0/rdar114699006
5.9.0: [stdlib] Delete bad @_effects(readonly) annotation
2 parents 4aefcf8 + 520a10c commit 404a69d

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

stdlib/public/core/Dictionary.swift

-1
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,6 @@ extension Dictionary: ExpressibleByDictionaryLiteral {
821821
/// - Parameter elements: The key-value pairs that will make up the new
822822
/// dictionary. Each key in `elements` must be unique.
823823
@inlinable
824-
@_effects(readonly)
825824
@_semantics("optimize.sil.specialize.generic.size.never")
826825
public init(dictionaryLiteral elements: (Key, Value)...) {
827826
let native = _NativeDictionary<Key, Value>(capacity: elements.count)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// RUN: %target-swift-frontend \
2+
// RUN: -primary-file %s \
3+
// RUN: -module-name main \
4+
// RUN: -O \
5+
// RUN: -g \
6+
// RUN: -target x86_64-apple-macos10.13 \
7+
// RUN: -emit-ir \
8+
// RUN: -o /dev/null \
9+
// RUN: -Xllvm -sil-print-function='$s4main1CCACycfc' \
10+
// RUN: 2>&1 | %FileCheck %s
11+
12+
// This test expects the stdlib to be in its properly optimized form.
13+
// REQUIRES: swift_stdlib_no_asserts,optimized_stdlib
14+
15+
// No need to run this test that has a hard-coded target of macos10.13 on other
16+
// platforms.
17+
// REQUIRES: OS=macosx
18+
19+
// Verify that after RetainSinking runs, the retain of the __EmptyArrayStorage
20+
// is _above_ the call to $sSD17dictionaryLiteralSDyxq_Gx_q_td_tcfCSS_SSTg5
21+
// which consumes the reference.
22+
// rdar://114699006
23+
24+
// CHECK-LABEL: *** SIL function after {{.*}} RetainSinking (retain-sinking)
25+
// CHECK-LABEL: sil {{.*}}@$s4main1CCACycfc : {{.*}} {
26+
// CHECK: [[REF:%[^,]+]] = raw_pointer_to_ref {{%[^,]+}} : $Builtin.RawPointer to $__EmptyArrayStorage
27+
// CHECK: [[BRIDGE_OBJECT:%[^,]+]] = unchecked_ref_cast [[REF]] : $__EmptyArrayStorage to $Builtin.BridgeObject
28+
// CHECK: [[BRIDGE_STORAGE:%[^,]+]] = struct $_BridgeStorage<__ContiguousArrayStorageBase> ([[BRIDGE_OBJECT]] :
29+
// CHECK: [[ARRAY_BUFFER:%[^,]+]] = struct $_ArrayBuffer<(String, String)> ([[BRIDGE_STORAGE]] :
30+
// CHECK: [[ARRAY:%[^,]+]] = struct $Array<(String, String)> ([[ARRAY_BUFFER]] :
31+
// CHECK: [[DICTIONARY_INIT:%[^,]+]] = function_ref @$sSD17dictionaryLiteralSDyxq_Gx_q_td_tcfCSS_SSTg5
32+
// CHECK-NEXT: strong_retain [[REF]] : $__EmptyArrayStorage
33+
// CHECK-NEXT: apply [[DICTIONARY_INIT]]([[ARRAY]], {{.*}})
34+
// CHECK-LABEL: } // end sil function '$s4main1CCACycfc'
35+
36+
class C {
37+
var d: [String : String] = [:]
38+
}

0 commit comments

Comments
 (0)