Files
swift-mirror/test/SILOptimizer/spec_conf2.swift
Erik Eckstein b54117c22d GenericSpecializer: drop unused indirect arguments.
If there is no read from an indirect argument, this argument has to be dropped.
At the call site the store to the argument's memory location could have been removed (based on the callee's memory effects).
Therefore, converting such an unused indirect argument to a direct argument, would load an uninitialized value at the call site.
This would lead to verifier errors and in worst case to a miscompile because IRGen can implicitly use dead arguments, e.g. for getting the type of a class reference.
2024-08-26 11:19:12 +02:00

27 lines
795 B
Swift

// RUN: %target-swift-frontend -O -Xllvm -sil-disable-pass=FunctionSignatureOpts -disable-arc-opts -emit-sil %s | %FileCheck %s
// We can't deserialize apply_inst with subst lists. When radar://14443304
// is fixed then we should convert this test to a SIL test.
protocol P { func p() }
protocol Q { func q() }
class Foo: P, Q {
@inline(never)
func p() {}
@inline(never)
func q() {}
}
@inline(never)
func inner_function<T : P & Q>(In In : T) { }
@inline(never)
func outer_function<T : P & Q>(In In : T) { inner_function(In: In) }
//CHECK: sil shared [noinline] {{.*}}@$s10spec_conf214outer_function2Inyx_tAA1PRzAA1QRzlFAA3FooC_Ttg5
//CHECK: function_ref @$s10spec_conf214inner_function2Inyx_tAA1PRzAA1QRzlFAA3FooC_Ttg5
//CHECK-NEXT: apply
//CHECK: return
outer_function(In: Foo())