[PATCH] D104801: [MemCpyOpt] Enable memcpy optimization for NVPTX back-end.

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 24 12:08:50 PDT 2021


tra added a comment.

In D104801#2838064 <https://reviews.llvm.org/D104801#2838064>, @fhahn wrote:

> So IIUC the behavior you want to express is that certain lib functions actually are considered available up to a point?

No, *intrinsics* are available. We can not currently lower any of them to libcalls and rely on alternative lowering mechanisms.

I think the pass' use of "is libcall available" is an imperfect proxy for either "should we bother looking for memcpy/memset ops" or for "can we materialize new memcpy/memset". It appears to assume that intrinsics and builtins either both supported or not supported.

> I'm not sure about having a dedicated TTI hook to specifically enable/disable the pass.

IMO TTI is the standard mechanism to make target-specific information available to otherwise generic passes. There are ~50 passes under lib/Transforms that utilize it.

> Would it be possible to mark the lib functions as available until the pass that lowers them runs (there's `TLI->disableAllFunctions`)?

I don't think it's feasible. Back-end has no idea or control over when/where the pass is going to run. 
E.g. I can run `opt -memcpyopt my.ll` and I would want it to work with NVPTX.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104801



More information about the llvm-commits mailing list