Files
swift-mirror/test/AutoDiff/SILOptimizer/linear_function_canonicalization.sil
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

29 lines
1.2 KiB
Plaintext

// RUN: %target-sil-opt -sil-print-types -differentiation -enable-experimental-linear-map-transposition %s | %FileCheck %s
sil_stage raw
import Swift
import Builtin
import _Differentiation
sil hidden @foo : $@convention(thin) (Float, Float, Float) -> Float {
bb0(%0 : $Float, %1 : $Float, %2 : $Float):
return %2 : $Float
}
sil @make_linear_func : $@convention(thin) () -> () {
bb0:
%orig = function_ref @foo : $@convention(thin) (Float, Float, Float) -> Float
%linear_fn_0 = linear_function [parameters 0] %orig : $@convention(thin) (Float, Float, Float) -> Float
%linear_fn_1 = linear_function [parameters 0 2] %orig : $@convention(thin) (Float, Float, Float) -> Float
return undef : $()
}
// CHECK-LABEL: sil @make_linear_func
// CHECK: bb0:
// CHECK: [[ORIG_FN:%.*]] = function_ref @foo : $@convention(thin) (Float, Float, Float) -> Float
// CHECK: linear_function [parameters 0] %0 : $@convention(thin) (Float, Float, Float) -> Float with_transpose undef : $@convention(thin) (Float, Float, Float) -> Float
// CHECK: linear_function [parameters 0 2] %0 : $@convention(thin) (Float, Float, Float) -> Float with_transpose undef : $@convention(thin) (Float, Float) -> (Float, Float)
// CHECK: }