[llvm] r372500 - [MIPS] Don't dereference dyn_cast<> Constant results. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 22 05:38:33 PDT 2019


Author: rksimon
Date: Sun Sep 22 05:38:32 2019
New Revision: 372500

URL: http://llvm.org/viewvc/llvm-project?rev=372500&view=rev
Log:
[MIPS] Don't dereference dyn_cast<> Constant results. NFCI.

The static analyzer is warning about potential null dereferences, but we should be able to use cast<> directly and if not assert will fire for us.

Modified:
    llvm/trunk/lib/Target/Mips/MipsSEISelDAGToDAG.cpp

Modified: llvm/trunk/lib/Target/Mips/MipsSEISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSEISelDAGToDAG.cpp?rev=372500&r1=372499&r2=372500&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsSEISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsSEISelDAGToDAG.cpp Sun Sep 22 05:38:32 2019
@@ -720,7 +720,7 @@ bool MipsSEDAGToDAGISel::trySelect(SDNod
   }
 
   case ISD::ConstantFP: {
-    ConstantFPSDNode *CN = dyn_cast<ConstantFPSDNode>(Node);
+    auto *CN = cast<ConstantFPSDNode>(Node);
     if (Node->getValueType(0) == MVT::f64 && CN->isExactlyValue(+0.0)) {
       if (Subtarget->isGP64bit()) {
         SDValue Zero = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), DL,
@@ -744,7 +744,7 @@ bool MipsSEDAGToDAGISel::trySelect(SDNod
   }
 
   case ISD::Constant: {
-    const ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Node);
+    auto *CN = cast<ConstantSDNode>(Node);
     int64_t Imm = CN->getSExtValue();
     unsigned Size = CN->getValueSizeInBits(0);
 




More information about the llvm-commits mailing list