Skip to content

Commit

Permalink
MLIR: improve num returns error (#2196)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Dec 13, 2024
1 parent 9fe27b8 commit 068ad9c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions enzyme/Enzyme/MLIR/Passes/EnzymeMLIRPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ struct DifferentiatePass : public DifferentiatePassBase<DifferentiatePass> {
OpBuilder builder(CI);
auto dCI = builder.create<func::CallOp>(CI.getLoc(), newFunc.getName(),
newFunc.getResultTypes(), args);
if (dCI.getNumResults() != CI.getNumResults()) {
CI.emitError() << "Incorrect number of results for enzyme operation: "
<< *CI << " expected " << *dCI;
return failure();
}
CI.replaceAllUsesWith(dCI);
CI->erase();
return success();
Expand Down

0 comments on commit 068ad9c

Please sign in to comment.