Skip to content

Commit

Permalink
cg: Fix triggering of an mlir assertion.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jezurko committed Oct 26, 2023
1 parent c2bcae6 commit 5e92b25
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/vast/CodeGen/CodeGenFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ namespace vast::cg
operation get_last_effective_operation(auto &block) {
auto last = &block.back();
if (auto scope = mlir::dyn_cast< core::ScopeOp >(last)) {
return get_last_effective_operation(scope.getBody().back());
auto &last_block = scope.getBody().back();
// Getting last op of empty block triggers MLIR assert
if (!last_block.empty())
return get_last_effective_operation(last_block);
}

return last;
Expand Down

0 comments on commit 5e92b25

Please sign in to comment.