From: Mon P Wang Date: Sat, 14 Mar 2009 00:25:19 +0000 (+0000) Subject: Avoid doing the transformation c ? 1.0 : 2.0 as load { 2.0, 1.0 } + c*4 X-Git-Tag: android-x86-6.0-r1~1003^2~21770 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=0b7a786842fd6601b99b1073e5393ebc928c1e6c;p=android-x86%2Fexternal-llvm.git 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66994 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 7cacbd30212..3e517cfe3a1 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/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(N2)) if (ConstantFPSDNode *FV = dyn_cast(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())) {