diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-05-05 21:34:35 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-05-05 21:34:35 +0000 |
| commit | 3d26577396f589141293a56d50235ea8ca2b3260 (patch) | |
| tree | 0e492a63567880075982a66fe5c2f453a580a16f | |
| parent | 3e3f2c63c389ba23346b7b681f43089ab37fd35d (diff) | |
| download | bcm5719-llvm-3d26577396f589141293a56d50235ea8ca2b3260.tar.gz bcm5719-llvm-3d26577396f589141293a56d50235ea8ca2b3260.zip | |
Fold (fpext (load x)) -> (extload x)
llvm-svn: 28130
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index a14a0761e75..872242e46fc 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2413,6 +2413,20 @@ SDOperand DAGCombiner::visitFP_EXTEND(SDNode *N) { // fold (fp_extend c1fp) -> c1fp if (N0CFP) return DAG.getNode(ISD::FP_EXTEND, VT, N0); + + // fold (fpext (load x)) -> (fpext (fpround (extload x))) + if (N0.getOpcode() == ISD::LOAD && N0.hasOneUse() && + (!AfterLegalize||TLI.isOperationLegal(ISD::EXTLOAD, N0.getValueType()))) { + SDOperand ExtLoad = DAG.getExtLoad(ISD::EXTLOAD, VT, N0.getOperand(0), + N0.getOperand(1), N0.getOperand(2), + N0.getValueType()); + CombineTo(N, ExtLoad); + CombineTo(N0.Val, DAG.getNode(ISD::FP_ROUND, N0.getValueType(), ExtLoad), + ExtLoad.getValue(1)); + return SDOperand(N, 0); // Return N so it doesn't get rechecked! + } + + return SDOperand(); } |

