Skip to content

Commit

Permalink
conv:tollvm: Fix assert triggered by lowering a call with void return…
Browse files Browse the repository at this point in the history
… value.
  • Loading branch information
Jezurko committed Oct 8, 2024
1 parent d132d2a commit a0f638b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/vast/Conversion/ToLLVM/IRsToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,14 @@ namespace vast::conv::irstollvm
auto call = rewriter.create< mlir::LLVM::CallOp >(
op.getLoc(), mk_fty(), op.getCallee(), ops.getOperands()
);
rewriter.replaceOp(op, call.getResults());

// the result gets removed when return type is void
// because the number of results is mismatched, we can't use replace (triggers assert)
// removing the op is ok, since in llvm dialect a void value can't be used anyway
if (call.getResult())
rewriter.replaceOp(op, call.getResults());
else
rewriter.eraseOp(op);

return logical_result::success();
}
Expand Down

0 comments on commit a0f638b

Please sign in to comment.