diff options
author | Chris Lattner <sabre@nondot.org> | 2006-03-13 06:26:26 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-03-13 06:26:26 +0000 |
commit | 79dbea5ab4c73243a4f6a09fa1637a618263493e (patch) | |
tree | 25dff9009f77d189520fc388282556d6e07df422 | |
parent | 8f4191d61978529e9e9d7ddc24dbcd528ef7dd4c (diff) |
add a couple of missing folds
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26724 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 1e05d583e8..1d6d40eb9a 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2102,6 +2102,18 @@ SDOperand DAGCombiner::visitFP_ROUND(SDNode *N) { // 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(); } |