[PATCH] D132439: [DAGCombiner][NFC] Use isa instead of dyn_cast in visitFP_ROUND.

WangLian via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 00:25:52 PDT 2022


Jimerlife created this revision.
Jimerlife added reviewers: RKSimon, craig.topper, sdesmalen, benshi001.
Jimerlife added a project: LLVM.
Herald added subscribers: StephenFan, ecnelises, hiraditya.
Herald added a project: All.
Jimerlife requested review of this revision.
Herald added subscribers: llvm-commits, jacquesguan.

If only determine whether node is `ConstantFPSDNode` or not, use `isa<ConstantFPSDNode>` maybe more proper.
No need to use `dyn_cast<ConstantFPSDNode>` to generate a variable of `ConstantFPSDNode *`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132439

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


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -15853,11 +15853,10 @@
 SDValue DAGCombiner::visitFP_ROUND(SDNode *N) {
   SDValue N0 = N->getOperand(0);
   SDValue N1 = N->getOperand(1);
-  ConstantFPSDNode *N0CFP = dyn_cast<ConstantFPSDNode>(N0);
   EVT VT = N->getValueType(0);
 
   // fold (fp_round c1fp) -> c1fp
-  if (N0CFP)
+  if (isa<ConstantFPSDNode>(N0))
     return DAG.getNode(ISD::FP_ROUND, SDLoc(N), VT, N0, N1);
 
   // fold (fp_round (fp_extend x)) -> x


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132439.454712.patch
Type: text/x-patch
Size: 647 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220823/88236d44/attachment.bin>


More information about the llvm-commits mailing list