Skip to content

Commit 11bd596

Browse files
committed
Revert "[AutoDiff] Better diagnose non-differentiability for throwing functions (swiftlang#81669)"
This reverts commit bc94ac3.
1 parent d9a7ac5 commit 11bd596

File tree

2 files changed

+4
-32
lines changed

2 files changed

+4
-32
lines changed

lib/SILOptimizer/Differentiation/PullbackCloner.cpp

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,12 +1780,8 @@ class PullbackCloner::Implementation final
17801780
void visitMoveValueInst(MoveValueInst *mvi) {
17811781
switch (getTangentValueCategory(mvi)) {
17821782
case 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;
1783+
llvm::report_fatal_error("AutoDiff does not support move_value with "
1784+
"SILValueCategory::Address");
17891785
case SILValueCategory::Object:
17901786
visitValueOwnershipInst(mvi, /*needZeroResAdj=*/true);
17911787
}
@@ -3125,21 +3121,8 @@ void PullbackCloner::Implementation::visitSILBasicBlock(SILBasicBlock *bb) {
31253121
break;
31263122
}
31273123
}
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-
}
3124+
} else
3125+
llvm::report_fatal_error("do not know how to handle this incoming bb argument");
31433126
}
31443127

31453128
// 3. Build the pullback successor cases for the `switch_enum`

test/AutoDiff/SILOptimizer/differentiation_diagnostics.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,6 @@ func try_apply_rethrows(_ x: Float) -> Float {
4646
return x
4747
}
4848

49-
// This generates `try_apply` which we do not know to handle yet, therefore
50-
// one should use a.differentialMap here. If / when differentiation of throwing
51-
// functions will be supported, we'd need to remove this diagnostics.
52-
// expected-error @+2 {{function is not differentiable}}
53-
// expected-note @+2 {{when differentiating this function definition}}
54-
@differentiable(reverse)
55-
func map_nondiff(_ a: [Float]) -> [Float] {
56-
// expected-note @+1 {{expression is not differentiable}}
57-
return a.map { $0 }
58-
}
59-
6049
//===----------------------------------------------------------------------===//
6150
// Unreachable
6251
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)