[PATCH] D62789: [DAGCombiner] Replace two unchecked dyn_casts with casts.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 1 21:49:42 PDT 2019

craig.topper created this revision.
craig.topper added a reviewer: george.burgess.iv.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

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.

[CFLGraph] Add FAdd to visitConstantExpr.

This looks like an oversight as all the other binary operators are present.

Accidentally noticed while auditing places that need FNeg handling.

Not sure how to test this.

  rG LLVM Github Monorepo



Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -8068,7 +8068,7 @@
   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 @@
   if (Level >= AfterLegalizeTypes)
     return SDValue();
-  MaskedLoadSDNode *MLD = dyn_cast<MaskedLoadSDNode>(N);
+  MaskedLoadSDNode *MLD = cast<MaskedLoadSDNode>(N);
   SDValue Mask = MLD->getMask();
   SDLoc DL(N);
Index: llvm/lib/Analysis/CFLGraph.h
--- llvm/lib/Analysis/CFLGraph.h
+++ llvm/lib/Analysis/CFLGraph.h
@@ -555,6 +555,7 @@
       case Instruction::Add:
+      case Instruction::FAdd:
       case Instruction::Sub:
       case Instruction::FSub:
       case Instruction::Mul:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62789.202583.patch
Type: text/x-patch
Size: 1123 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190602/5c28b622/attachment.bin>

More information about the llvm-commits mailing list