Files
swift-mirror/test/SILOptimizer/dead_bridging_code.swift
Erik Eckstein 6e6aae8d61 Mark all _unconditionallyBridgeFromObjectiveC functions as @_effects(readonly)
This enables removal of those bridging calls for dead parameters. Read-only lets the optimizer remove such a call if the result is not used.
Note that "readonly" means: no observable write operations. It's okay to allocate and initialize new objects.

rdar://problem/44944094
2018-10-10 08:24:26 -07:00

19 lines
418 B
Swift

// RUN: %target-swift-frontend -O -module-name=test -emit-sil %s | %FileCheck %s
// REQUIRES: objc_interop
// Check if the optimizer can remove dead briding calls.
import Foundation
class Myclass : NSObject {
// CHECK-LABEL: sil hidden [thunk] @$s4test7MyclassC3fooyySSFTo
// CHECK-NEXT: bb0(%0 : $NSString, %1 : $Myclass):
// CHECK-NEXT: tuple ()
// CHECK-NEXT: return
@objc func foo(_ s: String) {
}
}