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

via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 07:55:13 PST 2026


Author: Aiden Grossman
Date: 2026-03-04T07:55:08-08:00
New Revision: 8486d893bd7960ed6f0be8d2fa18cd96fb329a09

URL: https://github.com/llvm/llvm-project/commit/8486d893bd7960ed6f0be8d2fa18cd96fb329a09
DIFF: https://github.com/llvm/llvm-project/commit/8486d893bd7960ed6f0be8d2fa18cd96fb329a09.diff

LOG: [SelectionDAG] Fix -Wunused-variable after #179318 (#184623)

```
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.

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Removed: 
    


################################################################################
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