[PATCH] D59252: [TTI] getMemcpyCost

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 09:19:50 PDT 2019


SjoerdMeijer marked an inline comment as done.
SjoerdMeijer added inline comments.


================
Comment at: include/llvm/Analysis/TargetTransformInfoImpl.h:144
+  unsigned getMemcpyCost(const Instruction *I) {
+    return TTI::TCC_Basic;
+  }
----------------
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. :-)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59252/new/

https://reviews.llvm.org/D59252





More information about the llvm-commits mailing list