[llvm-commits] [llvm] r47937 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Chris Lattner
sabre at nondot.org
Tue Mar 4 22:46:59 PST 2008
Author: lattner
Date: Wed Mar 5 00:46:58 2008
New Revision: 47937
URL: http://llvm.org/viewvc/llvm-project?rev=47937&view=rev
Log:
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.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=47937&r1=47936&r2=47937&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Mar 5 00:46:58 2008
@@ -486,7 +486,9 @@
// 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 @@
// 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;
More information about the llvm-commits
mailing list