summaryrefslogtreecommitdiff
path: root/mlir/lib/Bytecode
diff options
context:
space:
mode:
authorRiver Riddle <riddleriver@gmail.com>2023-07-25 16:06:02 -0700
committerRiver Riddle <riddleriver@gmail.com>2023-07-25 16:06:33 -0700
commit0e6000f647682c6a32eaa5e746ec7b75e8c82306 (patch)
tree079c4268a19b5f0be7082c5eab3235a1f44af08d /mlir/lib/Bytecode
parent16d79d26b3b6b7ab4b024f478f05569e0a033c76 (diff)
[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.
Diffstat (limited to 'mlir/lib/Bytecode')
-rw-r--r--mlir/lib/Bytecode/Writer/IRNumbering.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/mlir/lib/Bytecode/Writer/IRNumbering.cpp b/mlir/lib/Bytecode/Writer/IRNumbering.cpp
index 788cf5b201f0..ef643ca6d74c 100644
--- a/mlir/lib/Bytecode/Writer/IRNumbering.cpp
+++ b/mlir/lib/Bytecode/Writer/IRNumbering.cpp
@@ -238,7 +238,7 @@ void IRNumberingState::computeGlobalNumberingState(Operation *rootOp) {
SmallVector<StackState> opStack;
rootOp->walk([&](Operation *op, const WalkStage &stage) {
// After visiting all nested regions, we pop the operation from the stack.
- if (stage.isAfterAllRegions()) {
+ if (op->getNumRegions() && stage.isAfterAllRegions()) {
// If no non-isolated uses were found, we can safely mark this operation
// as isolated from above.
OperationNumbering *numbering = opStack.pop_back_val().numbering;