[Mlir-commits] [mlir] [mlir][emitc] Use LLVM_FALLTHROUGH (PR #152464)

Andrey Timonin llvmlistbot at llvm.org
Thu Aug 7 02:20:08 PDT 2025


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

The switch case code was simplified using `LLVM_FALLTHROUGH`.

>From 5700531278a29ebf50318b552dfb4def2a9d2231 Mon Sep 17 00:00:00 2001
From: EtoAndruwa <timonina1909 at gmail.com>
Date: Thu, 7 Aug 2025 12:14:32 +0300
Subject: [PATCH] [mlir][emitc] Use LLVM_FALLTHROUGH

The switch case code was simplified using LLVM_FALLTHROUGH.
---
 mlir/lib/Dialect/EmitC/IR/EmitC.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
index e6a3154721faa..e5783ab84bad1 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,10 @@ 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:
+      if (!llvm::isa<Float16Type, BFloat16Type>(type))
+        return false;
+      LLVM_FALLTHROUGH;
     case 32:
     case 64:
       return true;



More information about the Mlir-commits mailing list