mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This enables dead-function elimination if such functions are not referenced with the module.
34 lines
734 B
Swift
34 lines
734 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend -parse-as-library -emit-module -emit-module-path=%t/Module.swiftmodule -module-name=Module -DMODULE %s -O -emit-sil | %FileCheck %s
|
|
|
|
// Also link to make sure we don't eliminate any needed symbols.
|
|
|
|
// RUN: %target-swift-frontend -parse-as-library -emit-module -emit-module-path=%t/Module.swiftmodule -module-name=Module -DMODULE %s -O -c -o module.o
|
|
// RUN: %target-build-swift -DMAIN %s -I%t -O -o %t/a.out
|
|
|
|
#if MODULE
|
|
|
|
// Check if the optimizer eliminates testit() in Module.
|
|
|
|
// CHECK-NOT: {{sil .*testit.*}}
|
|
|
|
@_alwaysEmitIntoClient
|
|
@inline(never)
|
|
public func testit() {
|
|
print("hello")
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
#if MAIN
|
|
|
|
import Module
|
|
|
|
public func caller() {
|
|
testit()
|
|
}
|
|
|
|
#endif
|
|
|