[Mlir-commits] [mlir] [mlir] Make IsInLoopPass thread-safe (PR #184036)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sun Mar 1 12:49:19 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: None (sweiglbosker)
<details>
<summary>Changes</summary>
Fixes #<!-- -->183999
---
Full diff: https://github.com/llvm/llvm-project/pull/184036.diff
2 Files Affected:
- (modified) mlir/test/Interfaces/LoopLikeInterface/test-block-loop.mlir (+1-1)
- (modified) mlir/test/lib/Interfaces/LoopLikeInterface/TestBlockInLoop.cpp (+13-11)
``````````diff
diff --git a/mlir/test/Interfaces/LoopLikeInterface/test-block-loop.mlir b/mlir/test/Interfaces/LoopLikeInterface/test-block-loop.mlir
index 2d4a775f0e931..0c807c44eacdd 100644
--- a/mlir/test/Interfaces/LoopLikeInterface/test-block-loop.mlir
+++ b/mlir/test/Interfaces/LoopLikeInterface/test-block-loop.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt %s --mlir-disable-threading -test-block-is-in-loop 2>&1 | FileCheck %s
+// RUN: mlir-opt %s -test-block-is-in-loop 2>&1 | FileCheck %s
module {
// Test function with only one bb
diff --git a/mlir/test/lib/Interfaces/LoopLikeInterface/TestBlockInLoop.cpp b/mlir/test/lib/Interfaces/LoopLikeInterface/TestBlockInLoop.cpp
index d695195064a6a..303cc37cfc1db 100644
--- a/mlir/test/lib/Interfaces/LoopLikeInterface/TestBlockInLoop.cpp
+++ b/mlir/test/lib/Interfaces/LoopLikeInterface/TestBlockInLoop.cpp
@@ -18,7 +18,7 @@ namespace {
/// This is a test pass that tests Blocks's isInLoop method by checking if each
/// block in a function is in a loop and outputing if it is
struct IsInLoopPass
- : public PassWrapper<IsInLoopPass, OperationPass<func::FuncOp>> {
+ : public PassWrapper<IsInLoopPass, OperationPass<ModuleOp>> {
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(IsInLoopPass)
StringRef getArgument() const final { return "test-block-is-in-loop"; }
@@ -27,16 +27,18 @@ struct IsInLoopPass
}
void runOnOperation() override {
- mlir::func::FuncOp func = getOperation();
- func.walk([](mlir::Block *block) {
- llvm::outs() << "Block is ";
- if (LoopLikeOpInterface::blockIsInLoop(block))
- llvm::outs() << "in a loop\n";
- else
- llvm::outs() << "not in a loop\n";
- block->print(llvm::outs());
- llvm::outs() << "\n";
- });
+ ModuleOp module = getOperation();
+ for (auto func : module.getOps<func::FuncOp>()) {
+ func.walk([](mlir::Block *block) {
+ llvm::outs() << "Block is ";
+ if (LoopLikeOpInterface::blockIsInLoop(block))
+ llvm::outs() << "in a loop\n";
+ else
+ llvm::outs() << "not in a loop\n";
+ block->print(llvm::outs());
+ llvm::outs() << "\n";
+ });
+ }
}
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/184036
More information about the Mlir-commits
mailing list