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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Aug 7 02:20:43 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Andrey Timonin (EtoAndruwa)

<details>
<summary>Changes</summary>

The switch case code was simplified using `LLVM_FALLTHROUGH`.

---
Full diff: https://github.com/llvm/llvm-project/pull/152464.diff


1 Files Affected:

- (modified) mlir/lib/Dialect/EmitC/IR/EmitC.cpp (+5-5) 


``````````diff
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;

``````````

</details>


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


More information about the Mlir-commits mailing list