Skip to content

Commit 0e6000f

Browse files
committed
[mlir:bytecode] Only visit the all regions path if the op has regions
Zero region operations return true for both isBeforeAllRegions and isAfterAllRegions when using WalkStage. The bytecode walk only expects region holding operations in the after regions path, so guard against that.
1 parent 16d79d2 commit 0e6000f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mlir/lib/Bytecode/Writer/IRNumbering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ void IRNumberingState::computeGlobalNumberingState(Operation *rootOp) {
238238
SmallVector<StackState> opStack;
239239
rootOp->walk([&](Operation *op, const WalkStage &stage) {
240240
// After visiting all nested regions, we pop the operation from the stack.
241-
if (stage.isAfterAllRegions()) {
241+
if (op->getNumRegions() && stage.isAfterAllRegions()) {
242242
// If no non-isolated uses were found, we can safely mark this operation
243243
// as isolated from above.
244244
OperationNumbering *numbering = opStack.pop_back_val().numbering;

0 commit comments

Comments
 (0)