[Mlir-commits] [mlir] [mlir][emitc] Simplify emitc::isSupportedFloatType (NFC) (PR #152464)

Andrey Timonin llvmlistbot at llvm.org
Thu Aug 7 08:21:24 PDT 2025


https://github.com/EtoAndruwa updated https://github.com/llvm/llvm-project/pull/152464

>From a00761f6b06ee98bd9f4f2825e5553884b90c5bd Mon Sep 17 00:00:00 2001
From: EtoAndruwa <timonina1909 at gmail.com>
Date: Thu, 7 Aug 2025 12:14:32 +0300
Subject: [PATCH 1/2] [mlir][emitc] Simplify emitc::isSupportedFloatType

---
 mlir/lib/Dialect/EmitC/IR/EmitC.cpp | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
index e6a3154721faa..0b4ca67e92ecf 100644
--- a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
+++ b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
@@ -17,6 +17,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/TypeSwitch.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
 
 using namespace mlir;
 using namespace mlir::emitc;
@@ -114,11 +115,8 @@ bool mlir::emitc::isIntegerIndexOrOpaqueType(Type type) {
 bool mlir::emitc::isSupportedFloatType(Type type) {
   if (auto floatType = llvm::dyn_cast<FloatType>(type)) {
     switch (floatType.getWidth()) {
-    case 16: {
-      if (llvm::isa<Float16Type, BFloat16Type>(type))
-        return true;
-      return false;
-    }
+    case 16:
+      return llvm::isa<Float16Type, BFloat16Type>(type);
     case 32:
     case 64:
       return true;

>From 865e41a1febd9e28be1a1444bfa9eb07d7f9c03a Mon Sep 17 00:00:00 2001
From: EtoAndruwa <timonina1909 at gmail.com>
Date: Thu, 7 Aug 2025 18:21:02 +0300
Subject: [PATCH 2/2] [mlir][emitc] Drop useless include

---
 mlir/lib/Dialect/EmitC/IR/EmitC.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
index 0b4ca67e92ecf..e79da9268693a 100644
--- a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
+++ b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
@@ -17,7 +17,6 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/TypeSwitch.h"
 #include "llvm/Support/Casting.h"
-#include "llvm/Support/Compiler.h"
 
 using namespace mlir;
 using namespace mlir::emitc;



More information about the Mlir-commits mailing list