[Mlir-commits] [mlir] [mlir][reducer] Repalce module.emitWarning with module.emitError in ReductionTree pass (PR #190584)
lonely eagle
llvmlistbot at llvm.org
Mon Apr 6 22:09:57 PDT 2026
https://github.com/linuxlonelyeagle updated https://github.com/llvm/llvm-project/pull/190584
>From 9bd0b6a4ef1fbff2fab5e27cbb456d64c7de4866 Mon Sep 17 00:00:00 2001
From: linuxlonelyeagle <2020382038 at qq.com>
Date: Tue, 7 Apr 2026 05:09:25 +0000
Subject: [PATCH] rebase main.
---
mlir/lib/Reducer/ReductionTreePass.cpp | 4 ++--
mlir/test/mlir-reduce/false.sh | 6 ++++++
mlir/test/mlir-reduce/invalid.mlir | 5 ++++-
mlir/test/mlir-reduce/simple-test.mlir | 2 +-
mlir/test/mlir-reduce/{test.sh => true.sh} | 0
5 files changed, 13 insertions(+), 4 deletions(-)
create mode 100755 mlir/test/mlir-reduce/false.sh
rename mlir/test/mlir-reduce/{test.sh => true.sh} (100%)
diff --git a/mlir/lib/Reducer/ReductionTreePass.cpp b/mlir/lib/Reducer/ReductionTreePass.cpp
index 83497143d9669..13cad4e7e9d47 100644
--- a/mlir/lib/Reducer/ReductionTreePass.cpp
+++ b/mlir/lib/Reducer/ReductionTreePass.cpp
@@ -89,7 +89,7 @@ static LogicalResult findOptimal(ModuleOp module, Region ®ion,
// While exploring the reduction tree, we always branch from an interesting
// node. Thus the root node must be interesting.
if (initStatus.first != Tester::Interestingness::True)
- return module.emitWarning() << "uninterested module will not be reduced";
+ return module.emitError() << "uninterested module will not be reduced";
llvm::SpecificBumpPtrAllocator<ReductionNode> allocator;
@@ -155,7 +155,7 @@ static LogicalResult eraseAllOpsInRegion(ModuleOp module, Region ®ion,
// While exploring the reduction tree, we always branch from an interesting
// node. Thus the root node must be interesting.
if (initStatus.first != Tester::Interestingness::True)
- return module.emitWarning() << "uninterested module will not be reduced";
+ return module.emitError() << "uninterested module will not be reduced";
llvm::SpecificBumpPtrAllocator<ReductionNode> allocator;
// Setting the ranges to {{0, 0}} will result in the deletion of all ops
diff --git a/mlir/test/mlir-reduce/false.sh b/mlir/test/mlir-reduce/false.sh
new file mode 100755
index 0000000000000..94d855ab1e58f
--- /dev/null
+++ b/mlir/test/mlir-reduce/false.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+#Replicate bug
+
+#Not interesting behavior
+exit 0
diff --git a/mlir/test/mlir-reduce/invalid.mlir b/mlir/test/mlir-reduce/invalid.mlir
index c421e20778311..43bcb68a32112 100644
--- a/mlir/test/mlir-reduce/invalid.mlir
+++ b/mlir/test/mlir-reduce/invalid.mlir
@@ -1,6 +1,9 @@
// UNSUPPORTED: system-windows
// RUN: not mlir-reduce -reduction-tree --no-implicit-module %s 2>&1 | FileCheck %s --check-prefix=CHECK-TREE
+// RUN: not mlir-reduce -reduction-tree='traversal-mode=0 test=%S/false.sh' %s 2>&1 | FileCheck %s --check-prefix=CHECK-INTERESTING
// The reduction passes are currently restricted to 'builtin.module'.
-// CHECK-TREE: error: top-level op must be 'builtin.module'
+// CHECK-TREE: error: top-level op must be 'builtin.module'
+
+// CHECK-INTERESTING: error: uninterested module will not be reduced
func.func private @foo()
diff --git a/mlir/test/mlir-reduce/simple-test.mlir b/mlir/test/mlir-reduce/simple-test.mlir
index b50c39590bb92..7d189db6a206a 100644
--- a/mlir/test/mlir-reduce/simple-test.mlir
+++ b/mlir/test/mlir-reduce/simple-test.mlir
@@ -1,5 +1,5 @@
// UNSUPPORTED: system-windows
-// RUN: mlir-reduce %s -reduction-tree='traversal-mode=0 test=%S/test.sh' | FileCheck %s
+// RUN: mlir-reduce %s -reduction-tree='traversal-mode=0 test=%S/true.sh' | FileCheck %s
// Since the test.sh always returns 1 (interesting),
// all operations within the ModuleOp should be erased.
diff --git a/mlir/test/mlir-reduce/test.sh b/mlir/test/mlir-reduce/true.sh
similarity index 100%
rename from mlir/test/mlir-reduce/test.sh
rename to mlir/test/mlir-reduce/true.sh
More information about the Mlir-commits
mailing list