<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Reid is right that this would go in
      memcpyopt, but... we there's an active discussion on the commit
      list which will solve this through a different mechanism.  There's
      an active desire to avoid teaching GVN and related pieces (of
      which memcpyopt is one) about first class aggregates.  We don't
      have enough active users of the feature to justify and maintain
      the complexity.  <br>
      <br>
      If you haven't already seen it, this background may help:
<a class="moz-txt-link-freetext" href="http://llvm.org/docs/Frontend/PerformanceTips.html#avoid-loads-and-stores-of-large-aggregate-type">http://llvm.org/docs/Frontend/PerformanceTips.html#avoid-loads-and-stores-of-large-aggregate-type</a><br>
      <br>
      The current proposal is to convert such aggregate loads and stores
      into their component pieces.  If that happens, you're example
      should come "for free" provided that the same example works when
      you break down the FCA into it's component pieces.  If it doesn't,
      please say so.  <br>
      <br>
      Philip<br>
      <br>
      On 03/05/2015 04:21 PM, Reid Kleckner wrote:<br>
    </div>
    <blockquote
cite="mid:CACs=ty+Zg_hyKitvqvuT+-863uYTQ0AjkDJDwU93QF-g1nfZUg@mail.gmail.com"
      type="cite">
      <div dir="ltr">I think lib/Transforms/Scalar/MemCpyOptimizer.cpp
        might be the right place for this, considering that most
        frontends will use memcpy for that copy anyway. It already has
        some logic for byval args.</div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Thu, Mar 5, 2015 at 3:51 PM, Mircea
          Trofin <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:mtrofin@google.com" target="_blank">mtrofin@google.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Hello all,
              <div><br>
              </div>
              <div>I'm trying to find the pass that would convert from:</div>
              <div>
                <div><br>
                </div>
                <div><font face="monospace, monospace">define void
                    @main(%struct* byval %ptr) {</font></div>
                <div><font face="monospace, monospace">  %val = load
                    %struct* %ptr</font></div>
                <div><font face="monospace, monospace">  %val.ptr =
                    alloca %struct</font></div>
                <div><font face="monospace, monospace">  store %struct
                    %val, %struct* %val.ptr</font></div>
                <div><font face="monospace, monospace">  call void
                    @extern_func(%struct* byval %val.ptr)</font></div>
                <div><font face="monospace, monospace">  ret void</font></div>
                <div><font face="monospace, monospace">}</font></div>
              </div>
              <div><br>
              </div>
              <div>to this:</div>
              <div>
                <div><font face="monospace, monospace">define void
                    @main(%struct* byval %ptr) {</font></div>
                <div><font face="monospace, monospace">  call void
                    @extern_func(%struct* byval %ptr)</font></div>
                <div><font face="monospace, monospace">  ret void</font></div>
                <div><font face="monospace, monospace">}</font></div>
              </div>
              <div><br>
              </div>
              <div>First, am I missing something - would this be a
                correct optimization?</div>
              <div><br>
              </div>
              <div>Thank you,</div>
              <div>Mircea.</div>
            </div>
            <br>
            _______________________________________________<br>
            LLVM Developers mailing list<br>
            <a moz-do-not-send="true" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> 
                   <a moz-do-not-send="true"
              href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
            <a moz-do-not-send="true"
              href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev"
              target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>