[llvm-dev] Which pass should be propagating memory copies

Keno Fischer via llvm-dev llvm-dev at lists.llvm.org
Wed May 17 08:22:56 PDT 2017


On Wed, May 17, 2017 at 12:09 AM, Peter Lawrence via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Keno,
>           Perhaps you can view the problem to be the memcpys themselves,
> We humans can look at the memcpys and see loads and stores
> but to almost all optimizer passes they aren’t what it is looking for,
> They instead see function calls which they mostly don’t touch,
>
> If these memcpys were inlined into plain old loads and stores
> The redundant loads and stores should be deleted by existing opts
>
> A question I have for you is, because this looks like “copy-in-copy-out”
> argument semantics,
> Which to me looks more like Ada than C, what was the source language ?
>
>
> Peter Lawrence.
>

No, I very much want the memcpys there. With individual stores I'd give up
hope that the optimizer can figure out what's going on here, esp. if it
gets beyond a few bytes, but I with memcpys it does seem doable. As for
which frontend produced this, we're considering adding language semantics
that would produce lots of code like this to julia, so we're looking into
getting the optimizer to fold the extra copies away.

Keno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170517/83a61c7a/attachment.html>


More information about the llvm-dev mailing list