You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[AutoDiff] Support differentiation of branching cast instructions.
Support differentiation of `is` and `as?` operators.
These operators lower to branching cast SIL instructions, requiring control
flow differentiation support.
Resolves SR-12898.
// CHECK: [VARIED] %14 = argument of bb3 : $Optional<Float>
189
+
// CHECK: bb4:
190
+
// CHECK: bb5:
191
+
// CHECK: [VARIED] %18 = argument of bb5 : $Float
192
+
// CHECK: bb6:
193
+
// CHECK: [NONE] %22 = tuple ()
194
+
195
+
// CHECK-LABEL: sil hidden [ossa] @${{.*}}checked_cast_addr_nonactive_result{{.*}} : $@convention(thin) <T where T : Differentiable> (@in_guaranteed T) -> @out T {
196
+
// CHECK: checked_cast_addr_br take_always T in %3 : $*T to Float in %5 : $*Float, bb1, bb2
197
+
// CHECK: }
198
+
199
+
// expected-error @+1 {{function is not differentiable}}
200
+
@differentiable
201
+
// expected-note @+1 {{when differentiating this function definition}}
// CHECK: [ACTIVE] %14 = argument of bb3 : $Optional<Float>
224
+
// CHECK: bb4:
225
+
// CHECK: [ACTIVE] %16 = argument of bb4 : $Float
226
+
// CHECK: [ACTIVE] %19 = alloc_stack $Float
227
+
// CHECK: bb5:
228
+
// CHECK: bb6:
229
+
// CHECK: [NONE] %27 = tuple ()
230
+
231
+
// CHECK-LABEL: sil hidden [ossa] @${{.*}}checked_cast_addr_active_result{{.*}} : $@convention(thin) <T where T : Differentiable> (@in_guaranteed T) -> @out T {
232
+
// CHECK: checked_cast_addr_br take_always T in %3 : $*T to Float in %5 : $*Float, bb1, bb2
0 commit comments