[llvm] e9ac2dc - [DAG] XformToShuffleWithZero - use dyn_cast instead of isa/cast pair. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 9 07:16:22 PST 2024


Author: Simon Pilgrim
Date: 2024-01-09T15:08:25Z
New Revision: e9ac2dc68d0b0578a5c1a98b4e083d133c1d7b2b

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

LOG: [DAG] XformToShuffleWithZero - use dyn_cast instead of isa/cast pair. NFCI.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 8b70148d8ce775..58c8ccfb63ea24 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -26542,10 +26542,10 @@ SDValue DAGCombiner::XformToShuffleWithZero(SDNode *N) {
       }
 
       APInt Bits;
-      if (isa<ConstantSDNode>(Elt))
-        Bits = Elt->getAsAPIntVal();
-      else if (isa<ConstantFPSDNode>(Elt))
-        Bits = cast<ConstantFPSDNode>(Elt)->getValueAPF().bitcastToAPInt();
+      if (auto *Cst = dyn_cast<ConstantSDNode>(Elt))
+        Bits = Cst->getAPIntValue();
+      else if (auto *CstFP = dyn_cast<ConstantFPSDNode>(Elt))
+        Bits = CstFP->getValueAPF().bitcastToAPInt();
       else
         return SDValue();
 


        


More information about the llvm-commits mailing list