[llvm] [SelectionDAG] Fix -Wunused-variable after #179318 (PR #184623)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 07:12:12 PST 2026


https://github.com/boomanaiden154 updated https://github.com/llvm/llvm-project/pull/184623

>From bde77bc934026b887fc9401e498acbb91b96414a Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Wed, 4 Mar 2026 14:26:11 +0000
Subject: [PATCH] [SelectionDAG] Fix -Wunused-variable after #179318

```
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:3572:26: error: unused variable 'NanEnc' [-Werror,-Wunused-variable]
 3572 |     const fltNanEncoding NanEnc = SrcSem.nanEncoding;
      |                          ^~~~~~
```

Simply inline the definition of the variable given it is not used
anywhere else and the assignment is a simple copy.
---
 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index a7aefc64bd500..08606c99097ae 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -3569,7 +3569,6 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
     const int SrcBias = 1 - APFloat::semanticsMinExponent(SrcSem);
 
     const fltNonfiniteBehavior NFBehavior = SrcSem.nonFiniteBehavior;
-    const fltNanEncoding NanEnc = SrcSem.nanEncoding;
 
     // Destination format parameters.
     const fltSemantics &DstSem = DstVT.getFltSemantics();
@@ -3632,7 +3631,7 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
       IsNaN = DAG.getNode(ISD::AND, dl, SetCCVT, IsExpAllOnes, IsMantNonZero);
     } else {
       // NanOnly + AllOnes (E4M3FN): NaN when all exp and mantissa bits are 1.
-      assert(NanEnc == fltNanEncoding::AllOnes);
+      assert(SrcSem.nanEncoding == fltNanEncoding::AllOnes);
       SDValue MantAllOnes = DAG.getConstant(MantMask, dl, IntVT);
       SDValue IsMantAllOnes =
           DAG.getSetCC(dl, SetCCVT, MantField, MantAllOnes, ISD::SETEQ);



More information about the llvm-commits mailing list