diff options
author | Raul E. Silvera <rsilvera@google.com> | 2014-03-10 22:59:13 +0000 |
---|---|---|
committer | Raul E. Silvera <rsilvera@google.com> | 2014-03-10 22:59:13 +0000 |
commit | ce376c0fcb8548b980257d30d43164c4a63f70ad (patch) | |
tree | 4674402872cdebcb5ba78a4aa3e54a8e5689666d /llvm/lib/CodeGen/BasicTargetTransformInfo.cpp | |
parent | 92aa8c220af260b5f4792f059549cb0ce7ef0a4d (diff) | |
download | bcm5719-llvm-ce376c0fcb8548b980257d30d43164c4a63f70ad.tar.gz bcm5719-llvm-ce376c0fcb8548b980257d30d43164c4a63f70ad.zip |
When analyzing vectors of element type that require legalization,
the legalization cost must be included to get an accurate
estimation of the total cost of the scalarized vector.
The inaccurate cost triggered unprofitable SLP vectorization on
32-bit X86.
Summary:
Include legalization overhead when computing scalarization cost
Reviewers: hfinkel, nadav
CC: chandlerc, rnk, llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2992
llvm-svn: 203509
Diffstat (limited to 'llvm/lib/CodeGen/BasicTargetTransformInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/BasicTargetTransformInfo.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp b/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp index e3ecf14d1f2..03c5eba3692 100644 --- a/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp +++ b/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp @@ -20,7 +20,6 @@ #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/Target/TargetLowering.h" #include <utility> - using namespace llvm; namespace { @@ -405,7 +404,9 @@ unsigned BasicTTI::getCmpSelInstrCost(unsigned Opcode, Type *ValTy, unsigned BasicTTI::getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index) const { - return 1; + std::pair<unsigned, MVT> LT = getTLI()->getTypeLegalizationCost(Val->getScalarType()); + + return LT.first; } unsigned BasicTTI::getMemoryOpCost(unsigned Opcode, Type *Src, |