[Mlir-commits] [mlir] 794f74e - Fix MLIR test pass crash

Mehdi Amini llvmlistbot at llvm.org
Mon Jul 24 19:55:05 PDT 2023


Author: Mehdi Amini
Date: 2023-07-24T19:54:56-07:00
New Revision: 794f74e2574331d30183887d733d151978006a33

URL: https://github.com/llvm/llvm-project/commit/794f74e2574331d30183887d733d151978006a33
DIFF: https://github.com/llvm/llvm-project/commit/794f74e2574331d30183887d733d151978006a33.diff

LOG: Fix MLIR test pass crash

The pass tried to fold in reverse-post-order, but it cause an issue
when a parent is folded before the chilren as they will still be
present in the worklist.
Use reverse-preorder instead here.

Fixes #64089

Added: 
    

Modified: 
    mlir/test/lib/Transforms/TestConstantFold.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/test/lib/Transforms/TestConstantFold.cpp b/mlir/test/lib/Transforms/TestConstantFold.cpp
index 9896cf372d269d..aa67e0a78d43b7 100644
--- a/mlir/test/lib/Transforms/TestConstantFold.cpp
+++ b/mlir/test/lib/Transforms/TestConstantFold.cpp
@@ -49,7 +49,7 @@ void TestConstantFold::runOnOperation() {
 
   // Collect and fold the operations within the operation.
   SmallVector<Operation *, 8> ops;
-  getOperation()->walk([&](Operation *op) { ops.push_back(op); });
+  getOperation()->walk<mlir::WalkOrder::PreOrder>([&](Operation *op) { ops.push_back(op); });
 
   // Fold the constants in reverse so that the last generated constants from
   // folding are at the beginning. This creates somewhat of a linear ordering to


        


More information about the Mlir-commits mailing list