Files
swift-mirror/test/AutoDiff/Serialization/differentiable_function.swift
Anton Korobeynikov 5b0746f967 Fix two Wasm test harness issues and re-enable more autodiff tests (#86931)
- Correctly construct cmake cmdline for wasmstdlib including cmake common host options. This is required in order to include e.g. `CMAKE_OSX_SYSROOT` on macOS, etc.
 - Ensure we're passing path to newly-built SDK to sil-opt

This makes almost every AutoDiff tests passing for Wasm target (the only exception is `AutoDiff/validation-test/always_emit_into_client/multi_module_struct_no_jvp.swift` as `expectCrash()` is not working properly on Wasm.
2026-02-09 19:15:52 -08:00

30 lines
1.3 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend %s -emit-module -parse-as-library -o %t
// RUN: llvm-bcanalyzer %t/differentiable_function.swiftmodule | %FileCheck %s -check-prefix=BCANALYZER
// RUN: %target-sil-opt -enable-sil-verify-all %t/differentiable_function.swiftmodule -o - | %FileCheck %s
// BCANALYZER-NOT: UnknownCode
import _Differentiation
func a(_ f: @differentiable(reverse) (Float) -> Float) {}
// CHECK: func a(_ f: @differentiable(reverse) (Float) -> Float)
func b(_ f: @differentiable(_linear) (Float) -> Float) {}
// CHECK: func b(_ f: @differentiable(_linear) (Float) -> Float)
func c(_ f: @differentiable(reverse) (Float, @noDerivative Float) -> Float) {}
// CHECK: func c(_ f: @differentiable(reverse) (Float, @noDerivative Float) -> Float)
func d(_ f: @differentiable(reverse) (inout Float) -> ()) {}
// CHECK: func d(_ f: @differentiable(reverse) (inout Float) -> ())
func e(_ f: @differentiable(reverse) (inout Float, inout Float) -> ()) {}
// CHECK: func e(_ f: @differentiable(reverse) (inout Float, inout Float) -> ())
func f(_ f: @differentiable(reverse) (inout Float) -> Float) {}
// CHECK: func f(_ f: @differentiable(reverse) (inout Float) -> Float)
func g(_ f: @differentiable(reverse) (inout Float, Float) -> Float) {}
// CHECK: func g(_ f: @differentiable(reverse) (inout Float, Float) -> Float)