diff options
author | Graham Yiu <gyiu@ca.ibm.com> | 2017-10-19 18:16:31 +0000 |
---|---|---|
committer | Graham Yiu <gyiu@ca.ibm.com> | 2017-10-19 18:16:31 +0000 |
commit | 488782efa3ea25a5ffbbd6cd2f84b6ec0838aa2f (patch) | |
tree | b66975f2dcfb9db52ced62977f0869b1126ce29f /llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp | |
parent | 6c3c02a3bd6a5703dd6b22c8254e92961d57d31d (diff) | |
download | bcm5719-llvm-488782efa3ea25a5ffbbd6cd2f84b6ec0838aa2f.tar.gz bcm5719-llvm-488782efa3ea25a5ffbbd6cd2f84b6ec0838aa2f.zip |
The cost of splitting a large vector instruction is not being taken into account by the getUserCost function. This was leading to some loops being over unrolled. The cost of a vector instruction is now being multiplied by the cost of the type legalization. This will return a more accurate cost.
Committing on behalf on Brad Nemanich (brad.nemanich@ibm.com)
Differential Revision: https://reviews.llvm.org/D38961
llvm-svn: 316174
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp index d3295a9d22e..52c5b688d35 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp @@ -189,6 +189,17 @@ int PPCTTIImpl::getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm, return PPCTTIImpl::getIntImmCost(Imm, Ty); } +unsigned PPCTTIImpl::getUserCost(const User *U, + ArrayRef<const Value *> Operands) { + if (U->getType()->isVectorTy()) { + // Instructions that need to be split should cost more. + std::pair<int, MVT> LT = TLI->getTypeLegalizationCost(DL, U->getType()); + return LT.first * BaseT::getUserCost(U, Operands); + } + + return BaseT::getUserCost(U, Operands); +} + void PPCTTIImpl::getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP) { if (ST->getDarwinDirective() == PPC::DIR_A2) { |