diff options
| author | Mon P Wang <wangmp@apple.com> | 2009-03-14 00:25:19 +0000 |
|---|---|---|
| committer | Mon P Wang <wangmp@apple.com> | 2009-03-14 00:25:19 +0000 |
| commit | c86715631cf936da5d94be15a07d14f0153f5b4c (patch) | |
| tree | 5f85cedcb8929b045370f026cbcea9de39e6c1ab | |
| parent | 52aba87df72b8c2ca4796b559a9544370ccfd8e2 (diff) | |
| download | bcm5719-llvm-c86715631cf936da5d94be15a07d14f0153f5b4c.tar.gz bcm5719-llvm-c86715631cf936da5d94be15a07d14f0153f5b4c.zip | |
Avoid doing the transformation c ? 1.0 : 2.0 as load { 2.0, 1.0 } + c*4
if FPConstant is legal because if the FPConstant doesn't need to be stored
in a constant pool, the transformation is unlikely to be profitable.
llvm-svn: 66994
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 7cacbd30212..3e517cfe3a1 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -5654,10 +5654,13 @@ SDValue DAGCombiner::SimplifySelectCC(DebugLoc DL, SDValue N0, SDValue N1, // it replaces two constant pool loads with one. We only do this if the FP // type is known to be legal, because if it isn't, then we are before legalize // types an we want the other legalization to happen first (e.g. to avoid - // messing with soft float). + // messing with soft float) and if the ConstantFP is not legal, because if + // it is legal, we may not need to store the FP constant in a constant pool. if (ConstantFPSDNode *TV = dyn_cast<ConstantFPSDNode>(N2)) if (ConstantFPSDNode *FV = dyn_cast<ConstantFPSDNode>(N3)) { if (TLI.isTypeLegal(N2.getValueType()) && + (TLI.getOperationAction(ISD::ConstantFP, N2.getValueType()) != + TargetLowering::Legal) && // If both constants have multiple uses, then we won't need to do an // extra load, they are likely around in registers for other users. (TV->hasOneUse() || FV->hasOneUse())) { |

