@@ -1780,8 +1780,12 @@ class PullbackCloner::Implementation final
17801780 void visitMoveValueInst (MoveValueInst *mvi) {
17811781 switch (getTangentValueCategory (mvi)) {
17821782 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 ;
17851789 case SILValueCategory::Object:
17861790 visitValueOwnershipInst (mvi, /* needZeroResAdj=*/ true );
17871791 }
@@ -3121,8 +3125,21 @@ void PullbackCloner::Implementation::visitSILBasicBlock(SILBasicBlock *bb) {
31213125 break ;
31223126 }
31233127 }
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+ }
31263143 }
31273144
31283145 // 3. Build the pullback successor cases for the `switch_enum`
0 commit comments