[PATCH] D59252: [TTI] getMemcpyCost
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 12 09:52:02 PDT 2019
arsenm added inline comments.
================
Comment at: include/llvm/Analysis/TargetTransformInfoImpl.h:144
+ unsigned getMemcpyCost(const Instruction *I) {
+ return TTI::TCC_Basic;
+ }
----------------
SjoerdMeijer wrote:
> t.p.northover wrote:
> > That seems optimistic, even as a default. I'd probably bump it to TCC_Expensive if just one load/store is needed, and a size-based estimate would be even better (is there a DataLayout handy to calculate length in terms of pointer-words?)
> Thanks for looking into this. Agreed that TCC_Basic doesn't make much sense.
>
> As a default size based estimate, I am thinking of this default:
>
> (2 * TCC_Basic) * (memcpy-count / pointer-size)
>
> where:
> (2 * TCC_Basic) is a load/store pair, and
> (memcpy-count / pointer-size) models the number of load/stores needed
>
> Since this will change behaviour, I probably need a test somewhere. :-)
A pointer size isn't relevant. We already have things like getMemcpyLoopLoweringType for when memcpy is expanded. The cost should also be much higher for unknown amounts
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59252/new/
https://reviews.llvm.org/D59252
More information about the llvm-commits
mailing list