summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-03-05 06:46:58 +0000
committerChris Lattner <sabre@nondot.org>2008-03-05 06:46:58 +0000
commit3dc3899007e469499d5dc6870f20e18b8260b002 (patch)
tree43dd774d8fce997a95903f428fa4435d7815af19 /llvm/lib/CodeGen
parent7ae17203f80f42ef97ed3c0f83bb6526b071077c (diff)
downloadbcm5719-llvm-3dc3899007e469499d5dc6870f20e18b8260b002.tar.gz
bcm5719-llvm-3dc3899007e469499d5dc6870f20e18b8260b002.zip
Improve comment, pass in the original VT so that we can shrink a long double constant
all the way to float, not stopping at double. llvm-svn: 47937
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 4129332f047..82324cd5b99 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -486,7 +486,9 @@ static SDOperand ExpandConstantFP(ConstantFPSDNode *CFP, bool UseCP,
// If a FP immediate is precise when represented as a float and if the
// target can do an extending load from float to double, we put it into
// the constant pool as a float, even if it's is statically typed as a
- // double.
+ // double. This shrinks FP constants and canonicalizes them for targets where
+ // an FP extending load is the same cost as a normal load (such as on the x87
+ // fp stack or PPC FP unit).
MVT::ValueType VT = CFP->getValueType(0);
ConstantFP *LLVMC = ConstantFP::get(MVT::getTypeForValueType(VT),
CFP->getValueAPF());
@@ -505,7 +507,7 @@ static SDOperand ExpandConstantFP(ConstantFPSDNode *CFP, bool UseCP,
// Only do this if the target has a native EXTLOAD instruction from
// smaller type.
TLI.isLoadXLegal(ISD::EXTLOAD, SVT) &&
- TLI.ShouldShrinkFPConstant(VT)) {
+ TLI.ShouldShrinkFPConstant(OrigVT)) {
const Type *SType = MVT::getTypeForValueType(SVT);
LLVMC = cast<ConstantFP>(ConstantExpr::getFPTrunc(LLVMC, SType));
VT = SVT;
OpenPOWER on IntegriCloud