diff options
| author | James Molloy <james.molloy@arm.com> | 2014-08-05 12:30:34 +0000 |
|---|---|---|
| committer | James Molloy <james.molloy@arm.com> | 2014-08-05 12:30:34 +0000 |
| commit | 2b8933c3545102c0bab2e6070ffdc856024a7567 (patch) | |
| tree | c45747841b1eda06906a72382cbe2ccd98e4c03f /llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp | |
| parent | ca4ea1ce595867f2bdcf204064193c36eb242937 (diff) | |
| download | bcm5719-llvm-2b8933c3545102c0bab2e6070ffdc856024a7567.tar.gz bcm5719-llvm-2b8933c3545102c0bab2e6070ffdc856024a7567.zip | |
Teach the SLP Vectorizer that keeping some values live over a callsite can have a cost.
Some types, such as 128-bit vector types on AArch64, don't have any callee-saved registers. So if a value needs to stay live over a callsite, it must be spilled and refilled. This cost is now taken into account.
llvm-svn: 214859
Diffstat (limited to 'llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp')
| -rw-r--r-- | llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp index b1c931e96e8..2058dd06b21 100644 --- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp @@ -124,6 +124,9 @@ public: unsigned getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment, unsigned AddressSpace) const override; + + unsigned getCostOfKeepingLiveOverCall(ArrayRef<Type*> Tys) const override; + /// @} }; @@ -498,3 +501,15 @@ unsigned AArch64TTI::getMemoryOpCost(unsigned Opcode, Type *Src, return LT.first; } + +unsigned AArch64TTI::getCostOfKeepingLiveOverCall(ArrayRef<Type*> Tys) const { + unsigned Cost = 0; + for (auto *I : Tys) { + if (!I->isVectorTy()) + continue; + if (I->getScalarSizeInBits() * I->getVectorNumElements() == 128) + Cost += getMemoryOpCost(Instruction::Store, I, 128, 0) + + getMemoryOpCost(Instruction::Load, I, 128, 0); + } + return Cost; +} |

