// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime // REQUIRES: CPU=x86_64 import Swift protocol Foo: class { } // CHECK-LABEL: define{{( protected)?}} void @store_weak({ %swift.weak, i8** }* noalias nocapture sret, i64, i64) {{.*}} { // CHECK: entry: // CHECK-objc: [[INSTANCE:%.*]] = inttoptr i64 %1 to %objc_object* // CHECK-native: [[INSTANCE:%.*]] = inttoptr i64 %1 to %swift.refcounted* // CHECK: [[WTABLE:%.*]] = inttoptr i64 %2 to i8** // CHECK: [[WTABLE_SLOT:%.*]] = getelementptr inbounds { %swift.weak, i8** }, { %swift.weak, i8** }* %0, i32 0, i32 1 // CHECK: store i8** [[WTABLE]], i8*** [[WTABLE_SLOT]], align 8 // CHECK: [[INSTANCE_SLOT:%.*]] = getelementptr inbounds { %swift.weak, i8** }, { %swift.weak, i8** }* %0, i32 0, i32 0 // CHECK-objc: call void @swift_unknownWeakAssign(%swift.weak* [[INSTANCE_SLOT]], %objc_object* [[INSTANCE]]) {{#[0-9]+}} // CHECK-native: call void @swift_weakAssign(%swift.weak* [[INSTANCE_SLOT]], %swift.refcounted* [[INSTANCE]]) {{#[0-9]+}} // CHECK: ret void // CHECK: } sil @store_weak : $@convention(thin) (@owned Foo?) -> @out @sil_weak Foo? { entry(%w : $*@sil_weak Foo?, %x : $Foo?): store_weak %x to %w : $*@sil_weak Foo? return undef : $() }