[llvm] r362315 - [DAGCombiner] Replace two unchecked dyn_casts with casts.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 1 20:31:01 PDT 2019


Author: ctopper
Date: Sat Jun  1 20:31:01 2019
New Revision: 362315

URL: http://llvm.org/viewvc/llvm-project?rev=362315&view=rev
Log:
[DAGCombiner] Replace two unchecked dyn_casts with casts.

The results of the dyn_casts were immediately dereferenced on the next line
so they had better not be null.

I don't think there's any way for these dyn_casts to fail, so use a cast
of adding null check.

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

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=362315&r1=362314&r2=362315&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sat Jun  1 20:31:01 2019
@@ -8068,7 +8068,7 @@ SDValue DAGCombiner::visitMSTORE(SDNode
   if (Level >= AfterLegalizeTypes)
     return SDValue();
 
-  MaskedStoreSDNode *MST = dyn_cast<MaskedStoreSDNode>(N);
+  MaskedStoreSDNode *MST = cast<MaskedStoreSDNode>(N);
   SDValue Mask = MST->getMask();
   SDValue Data  = MST->getValue();
   EVT VT = Data.getValueType();
@@ -8219,7 +8219,7 @@ SDValue DAGCombiner::visitMLOAD(SDNode *
   if (Level >= AfterLegalizeTypes)
     return SDValue();
 
-  MaskedLoadSDNode *MLD = dyn_cast<MaskedLoadSDNode>(N);
+  MaskedLoadSDNode *MLD = cast<MaskedLoadSDNode>(N);
   SDValue Mask = MLD->getMask();
   SDLoc DL(N);
 




More information about the llvm-commits mailing list