mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
... including all SIL functions with are transitively referenced from such witness tables. After the last devirtualizer run witness tables are not needed in the optimizer anymore. We can delete witness tables with an available-externally linkage. IRGen does not emit such witness tables anyway. This can save a little bit of compile time, because it reduces the amount of SIL at the end of the optimizer pipeline. It also reduces the size of the SIL output after the optimizer, which makes debugging the SIL output easier.
28 lines
953 B
Swift
28 lines
953 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend -emit-module %S/Inputs/sil_witness_tables_external_input.swift -o %t/Swift.swiftmodule -parse-stdlib -parse-as-library -module-name Swift -module-link-name swiftCore
|
|
// RUN: %target-swift-frontend -O -I %t %s -Xllvm -sil-disable-pass=late-deadfuncelim -emit-sil | %FileCheck %s
|
|
// RUN: %target-swift-frontend -O -I %t %s -emit-sil | %FileCheck -check-prefix=CHECK-DFE %s
|
|
|
|
import Swift
|
|
|
|
// Make sure the specializer produces an external witness table.
|
|
//
|
|
// CHECK: sil_witness_table public_external X: P module Swift {
|
|
|
|
// Also check that late dead-function-elimination is removing externally
|
|
// available witness tables.
|
|
//
|
|
// CHECK-DFE-NOT: sil_witness_table public_external
|
|
|
|
func doSomething<T : P>(_ t : T) -> Y {
|
|
return t.doSomething()
|
|
}
|
|
|
|
func done() -> Y {
|
|
let x = X()
|
|
return doSomething(x)
|
|
}
|
|
|
|
// Make sure dead function elimination does not get rid of done and doSomething.
|
|
done()
|