Skip to content

Commit

Permalink
binop error handler (#1320)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Jul 7, 2023
1 parent 05601d7 commit de02665
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions enzyme/Enzyme/AdjointGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -2666,8 +2666,13 @@ class AdjointGenerator
}
ss << "cannot handle unknown binary operator: " << BO << "\n";
if (CustomErrorHandler) {
CustomErrorHandler(ss.str().c_str(), wrap(&BO), ErrorType::NoDerivative,
gutils, nullptr, wrap(&Builder2));
auto rval = unwrap(CustomErrorHandler(ss.str().c_str(), wrap(&BO),
ErrorType::NoDerivative, gutils,
nullptr, wrap(&Builder2)));
if (!rval)
rval = Constant::getNullValue(gutils->getShadowType(BO.getType()));
if (!gutils->isConstantValue(&BO))
setDiffe(&BO, rval, Builder2);
} else {
llvm::errs() << ss.str() << "\n";
report_fatal_error("unknown binary operator");
Expand Down

0 comments on commit de02665

Please sign in to comment.