@@ -1780,8 +1780,12 @@ class PullbackCloner::Implementation final
1780
1780
void visitMoveValueInst (MoveValueInst *mvi) {
1781
1781
switch (getTangentValueCategory (mvi)) {
1782
1782
case SILValueCategory::Address:
1783
- llvm::report_fatal_error (" AutoDiff does not support move_value with "
1784
- " SILValueCategory::Address" );
1783
+ LLVM_DEBUG (getADDebugStream () << " AutoDiff does not support move_value with "
1784
+ " SILValueCategory::Address" );
1785
+ getContext ().emitNondifferentiabilityError (
1786
+ mvi, getInvoker (), diag::autodiff_expression_not_differentiable_note);
1787
+ errorOccurred = true ;
1788
+ return ;
1785
1789
case SILValueCategory::Object:
1786
1790
visitValueOwnershipInst (mvi, /* needZeroResAdj=*/ true );
1787
1791
}
@@ -3121,8 +3125,21 @@ void PullbackCloner::Implementation::visitSILBasicBlock(SILBasicBlock *bb) {
3121
3125
break ;
3122
3126
}
3123
3127
}
3124
- } else
3125
- llvm::report_fatal_error (" do not know how to handle this incoming bb argument" );
3128
+ } else {
3129
+ LLVM_DEBUG (getADDebugStream () <<
3130
+ " do not know how to handle this incoming bb argument" );
3131
+ if (auto term = bbArg->getSingleTerminator ()) {
3132
+ getContext ().emitNondifferentiabilityError (term, getInvoker (),
3133
+ diag::autodiff_expression_not_differentiable_note);
3134
+ } else {
3135
+ // This will be a bit confusing, but still better than nothing.
3136
+ getContext ().emitNondifferentiabilityError (bbArg, getInvoker (),
3137
+ diag::autodiff_expression_not_differentiable_note);
3138
+ }
3139
+
3140
+ errorOccurred = true ;
3141
+ return ;
3142
+ }
3126
3143
}
3127
3144
3128
3145
// 3. Build the pullback successor cases for the `switch_enum`
0 commit comments