Commit Graph

1 Commits

Author SHA1 Message Date
Andrew Savonichev
fc640dbc02 [AutoDiff] Emit a diagnostic for non-differentiable active values (#67697)
For some values we cannot compute types for differentiation (for example,
tangent vector type), so it is better to diagnose them earlier. Otherwise we hit
assertions when generating code for such invalid values.

The LIT test is a reduced reproducer from the issue #66996. Before the patch the
compiler crashed while trying to get a tangent vector type for the following
value (partial_apply):

    %54 = function_ref @$s4null1o2ffSdAA1FV_tFSdyKXEfu0_ :
      $@convention(thin) @substituted <τ_0_0> (@inout_aliasable Double)
      -> (@out τ_0_0, @error any Error) for <Double>

    %55 = partial_apply [callee_guaranteed] %54(%2) :
      $@convention(thin) @substituted <τ_0_0> (@inout_aliasable Double)
      -> (@out τ_0_0, @error any Error) for <Double>

Now we emit a diagnostic instead.

The patch resolves issues #66996 and #63331
2023-09-01 10:48:45 -07:00