[Mlir-commits] [mlir] 0e6000f - [mlir:bytecode] Only visit the all regions path if the op has regions

River Riddle llvmlistbot at llvm.org
Tue Jul 25 16:07:23 PDT 2023


Author: River Riddle
Date: 2023-07-25T16:06:33-07:00
New Revision: 0e6000f647682c6a32eaa5e746ec7b75e8c82306

URL: https://github.com/llvm/llvm-project/commit/0e6000f647682c6a32eaa5e746ec7b75e8c82306
DIFF: https://github.com/llvm/llvm-project/commit/0e6000f647682c6a32eaa5e746ec7b75e8c82306.diff

LOG: [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.

Added: 
    

Modified: 
    mlir/lib/Bytecode/Writer/IRNumbering.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Bytecode/Writer/IRNumbering.cpp b/mlir/lib/Bytecode/Writer/IRNumbering.cpp
index 788cf5b201f02b..ef643ca6d74c76 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;


        


More information about the Mlir-commits mailing list