|
| 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