[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Mar 12 22:26:38 PST 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.123 -> 1.124
---
Log message:

add a couple of missing folds


---
Diffs of the changes:  (+12 -0)

 DAGCombiner.cpp |   12 ++++++++++++
 1 files changed, 12 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.123 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.124
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.123	Sun Mar  5 13:53:55 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Mon Mar 13 00:26:26 2006
@@ -2102,6 +2102,18 @@
   // fold (fp_round c1fp) -> c1fp
   if (N0CFP)
     return DAG.getNode(ISD::FP_ROUND, VT, N0);
+  
+  // fold (fp_round (fp_extend x)) -> x
+  if (N0.getOpcode() == ISD::FP_EXTEND && VT == N0.getOperand(0).getValueType())
+    return N0.getOperand(0);
+  
+  // fold (fp_round (copysign X, Y)) -> (copysign (fp_round X), Y)
+  if (N0.getOpcode() == ISD::FCOPYSIGN && N0.Val->hasOneUse()) {
+    SDOperand Tmp = DAG.getNode(ISD::FP_ROUND, VT, N0.getOperand(0));
+    AddToWorkList(Tmp.Val);
+    return DAG.getNode(ISD::FCOPYSIGN, VT, Tmp, N0.getOperand(1));
+  }
+  
   return SDOperand();
 }
 






More information about the llvm-commits mailing list