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

WangLian via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 20:42:43 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2887d7786f01: [DAGCombiner] Use FoldConstantArithmetic instead of dyn_cast in visitFP_ROUND. (authored by Jimerlife).

Changed prior to commit:
  https://reviews.llvm.org/D132439?vs=455156&id=455469#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132439/new/

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
@@ -15858,12 +15858,12 @@
 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)
-    return DAG.getNode(ISD::FP_ROUND, SDLoc(N), VT, N0, N1);
+  if (SDValue C =
+          DAG.FoldConstantArithmetic(ISD::FP_ROUND, SDLoc(N), VT, {N0, N1}))
+    return C;
 
   // fold (fp_round (fp_extend x)) -> x
   if (N0.getOpcode() == ISD::FP_EXTEND && VT == N0.getOperand(0).getValueType())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132439.455469.patch
Type: text/x-patch
Size: 807 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220825/dae17eb7/attachment.bin>


More information about the llvm-commits mailing list