[Mlir-commits] [mlir] [mlir][arith] Delete unnecessary error logs (PR #94970)

donald chen llvmlistbot at llvm.org
Mon Jun 10 08:06:30 PDT 2024


https://github.com/cxy-1993 updated https://github.com/llvm/llvm-project/pull/94970

>From 55af06e96d56fd4419e9663ef4f72e26a7666235 Mon Sep 17 00:00:00 2001
From: cxy <chenxunyu1993 at gmail.com>
Date: Mon, 10 Jun 2024 20:19:20 +0800
Subject: [PATCH] [mlir][arith] Delete unnecessary error logs

Function `getNeutralElement` already indicates "cannot find neutral element"
by returning nullptr through the return value, and no additional error log needs
to be output.
---
 mlir/lib/Dialect/Arith/IR/ArithOps.cpp                 | 1 -
 mlir/test/Dialect/Linalg/transform-tile-reduction.mlir | 1 -
 2 files changed, 2 deletions(-)

diff --git a/mlir/lib/Dialect/Arith/IR/ArithOps.cpp b/mlir/lib/Dialect/Arith/IR/ArithOps.cpp
index 5797c5681a5fd..2f6647a2a27b1 100644
--- a/mlir/lib/Dialect/Arith/IR/ArithOps.cpp
+++ b/mlir/lib/Dialect/Arith/IR/ArithOps.cpp
@@ -2544,7 +2544,6 @@ std::optional<TypedAttr> mlir::arith::getNeutralElement(Operation *op) {
           .Case([](arith::MulIOp op) { return AtomicRMWKind::muli; })
           .Default([](Operation *op) { return std::nullopt; });
   if (!maybeKind) {
-    op->emitError() << "Unknown neutral element for: " << *op;
     return std::nullopt;
   }
 
diff --git a/mlir/test/Dialect/Linalg/transform-tile-reduction.mlir b/mlir/test/Dialect/Linalg/transform-tile-reduction.mlir
index f3cf7c4dffa05..8feb3c2a2c306 100644
--- a/mlir/test/Dialect/Linalg/transform-tile-reduction.mlir
+++ b/mlir/test/Dialect/Linalg/transform-tile-reduction.mlir
@@ -355,7 +355,6 @@ module {
     %0 = linalg.generic {indexing_maps = [#map, #map1], iterator_types = ["parallel", "reduction"]} ins(%arg0 : tensor<?x?xf32>) outs(%arg1 : tensor<?xf32>) {
     ^bb0(%in: f32, %out: f32):
       %1 = llvm.fmul %in, %in  : f32
-      // expected-error @below {{Unknown neutral element for:}}
       %2 = llvm.fadd %1, %out  : f32
       linalg.yield %2 : f32
     } -> tensor<?xf32>



More information about the Mlir-commits mailing list