Files
swift-mirror/test/SILOptimizer/functionsigopts_crash.swift
Erik Eckstein 741c6c38df Swift Optimizer: add the ComputeSideEffects pass.
Computes the side effects for a function, which consists of argument- and global effects.
This is similar to the ComputeEscapeEffects pass, just for side-effects.
2022-10-05 07:38:11 +02:00

38 lines
823 B
Swift

// RUN: %target-swift-frontend -module-name main -O -emit-sil -primary-file %s | %FileCheck %s
protocol P {
func foo()
}
public struct Inner {
var x: Int
var y: Int
}
public struct S : P {
var i: Inner
func foo() {
print(i.x)
}
}
// Check that FSO does not crash due to a missing decl on the function argument.
// Following specializations should be done:
// * FSO: existential to protocol constrained generic
// * generic specialization <S>
// * FSO: argument explosion
// CHECK-LABEL: sil shared [noinline] @$s4main6testityyAA1P_pFTf4e_nAA1SV_Tg5Tf4x_n : $@convention(thin) (Int) -> () {
// CHECK: // %0 "p"
// CHECK: } // end sil function '$s4main6testityyAA1P_pFTf4e_nAA1SV_Tg5Tf4x_n'
@inline(never)
func testit(_ p: P) {
p.foo()
}
public func callit(s: S) {
testit(s)
}