blob: c308cdf0ad79e9d5afe148b5beb886bcb0ab39ea [file] [log] [blame] [edit]
// RUN: %target-sil-opt %s | %FileCheck %s
sil_stage raw
import Builtin
import Swift
// CHECK-LABEL: sil [differentiable source 0 wrt 0, 1 vjp @bar_vjp] @bar
sil [differentiable source 0 wrt 0, 1 vjp @bar_vjp] @bar : $@convention(thin) (Float, Float) -> Float {
entry(%0: $Float, %1: $Float):
return undef: $Float
}
sil @bar_vjp : $@convention(thin) (Float, Float) -> (Float, (Float) -> (Float, Float)) {
entry(%0: $Float, %1: $Float):
return undef: $(Float, (Float) -> (Float, Float))
}
// CHECK-LABEL: sil [differentiable source 0 wrt 0, 1 vjp @foo_vjp where T : _Differentiable, U : _Differentiable, V : _Differentiable] @foo
sil [differentiable source 0 wrt 0, 1 vjp @foo_vjp where T : Differentiable, U : Differentiable, V : Differentiable] @foo : $@convention(thin) <T, U, V> (@in_guaranteed T, @in_guaranteed U, @in_guaranteed V) -> @out V {
entry(%0 : $*V, %1 : $*T, %2 : $*U, %3 : $*V):
return undef: $()
}
sil @foo_vjp : $@convention(thin) <T, U, V where T : _Differentiable, U : _Differentiable, V : _Differentiable> (@in_guaranteed T, @in_guaranteed U, @in_guaranteed V) -> (@out V, @owned @callee_guaranteed (@in_guaranteed V) -> (@out T, @out U)) {
bb0(%0 : $*V, %1 : $*T, %2 : $*U, %3 : $*V):
return undef: $@callee_guaranteed (@in_guaranteed V) -> (@out T, @out U)
}