[clang] [NFC][Codegen] Remove dead switch cases (PR #195772)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 18:31:04 PDT 2026


https://github.com/shafik created https://github.com/llvm/llvm-project/pull/195772

Static analysis flagged these cases as dead code b/c the `& RoundingMask` mask ensured that the other switch cases completely covered the results.

>From f6303510d74334ded536854a0c9c353977be2a5c Mon Sep 17 00:00:00 2001
From: Shafik Yaghmour <shafik.yaghmour at intel.com>
Date: Mon, 4 May 2026 18:27:22 -0700
Subject: [PATCH] [NFC][Codegen] Remove dead switch cases

Static analysis flagged these cases as dead code b/c the `& RoundingMask`
mask ensured that the other switch cases completely covered the results.
---
 clang/lib/CodeGen/TargetBuiltins/X86.cpp | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/clang/lib/CodeGen/TargetBuiltins/X86.cpp b/clang/lib/CodeGen/TargetBuiltins/X86.cpp
index 9645ed87b8ef3..49c1da4e447e7 100644
--- a/clang/lib/CodeGen/TargetBuiltins/X86.cpp
+++ b/clang/lib/CodeGen/TargetBuiltins/X86.cpp
@@ -102,8 +102,6 @@ static Value *emitX86RoundImmediate(CodeGenFunction &CGF, Value *X,
     case 0b11:
       ID = Intrinsic::experimental_constrained_trunc;
       break;
-    default:
-      llvm_unreachable("Invalid rounding mode");
     }
 
     Function *F = CGF.CGM.getIntrinsic(ID, X->getType());
@@ -123,8 +121,6 @@ static Value *emitX86RoundImmediate(CodeGenFunction &CGF, Value *X,
   case 0b11:
     ID = Intrinsic::trunc;
     break;
-  default:
-    llvm_unreachable("Invalid rounding mode");
   }
 
   Function *F = CGF.CGM.getIntrinsic(ID, X->getType());



More information about the cfe-commits mailing list