1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
// RUN: %target-swift-frontend -parse-sil -emit-ir -disable-llvm-optzns -O %s | %FileCheck --check-prefix=CHECK-%target-runtime %s
// RUN: %target-swift-frontend -parse-sil -emit-ir -disable-llvm-optzns -Ounchecked %s | %FileCheck --check-prefix=CHECK-%target-runtime %s
// RUN: %target-swift-frontend -parse-sil -emit-ir -disable-llvm-optzns -Onone %s | %FileCheck --check-prefix=ONONE %s
// REQUIRES: CPU=i386 || CPU=x86_64
// At -Onone we don't run the LLVM ARC optimizer, so the fixLifetime call is
// unnecessary.
// ONONE-NOT: @__swift_fixLifetime
// CHECK-objc-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @test(ptr %0, ptr %1, ptr %2, ptr %3, ptr %4, ptr noalias nocapture dereferenceable({{.*}}) %5, {{(i64|i32)}} %6, {{(i64|i32)}} %7) {{.*}} {
// CHECK-objc: entry:
// CHECK-objc: call void @__swift_fixLifetime(ptr
// CHECK-objc: call void @__swift_fixLifetime(ptr
// CHECK-objc: call void @__swift_fixLifetime(ptr
// CHECK-objc: call void @__swift_fixLifetime(ptr
// CHECK-objc: call void @__swift_fixLifetime(ptr
// CHECK-objc: call void @__swift_fixLifetime(ptr
// CHECK-objc: [[TEMP:%.*]] = inttoptr {{(i64|i32)}} %6 to ptr
// CHECK-objc: call void @__swift_fixLifetime(ptr [[TEMP]])
// CHECK-objc: call void @__swift_fixLifetime(ptr
// CHECK-native-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @test(ptr %0, ptr %1, ptr %2, ptr %3, ptr %4, ptr noalias nocapture dereferenceable({{.*}}) %5, {{(i64|i32)}} %6, {{(i64|i32)}} %7) {{.*}} {
// CHECK-native: entry:
// CHECK-native: call void @__swift_fixLifetime(ptr
// CHECK-native: call void @__swift_fixLifetime(ptr
// CHECK-native: call void @__swift_fixLifetime(ptr
// CHECK-native: call void @__swift_fixLifetime(ptr
// CHECK-native: call void @__swift_fixLifetime(ptr
// CHECK-native: call void @__swift_fixLifetime(ptr
// CHECK-native: call void @__swift_fixLifetime(ptr
import Builtin
sil_stage canonical
typealias AnyObject = Builtin.AnyObject
class C {}
sil_vtable C {}
protocol P : class {}
typealias F = () -> ()
struct Agg {
var c : C
var p : P
var f : F
}
enum MyOptional<T> {
case none
case some(T)
}
sil [Onone] @test
: $@convention(thin) (C, P, @callee_owned () -> (), Agg, @guaranteed MyOptional<P>) -> () {
bb0(%0 : $C, %1 : $P, %2 : $@callee_owned () -> (), %3 : $Agg, %4 : $MyOptional<P>):
fix_lifetime %0 : $C
fix_lifetime %1 : $P
fix_lifetime %2 : $@callee_owned () -> ()
fix_lifetime %3 : $Agg
fix_lifetime %4 : $MyOptional<P>
%5 = alloc_stack $C
fix_lifetime %5 : $*C
dealloc_stack %5 : $*C
%9999 = tuple()
return %9999 : $()
}
|