<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, Jul 3, 2018 at 2:12 PM Friedman, Eli via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF">
    <div class="m_6115844916611681071moz-cite-prefix">On 7/3/2018 1:25 PM, Chandler Carruth
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_quote">
          <div dir="ltr">On Tue, Jul 3, 2018 at 1:05 PM Friedman, Eli
            <<a href="mailto:efriedma@codeaurora.org" target="_blank">efriedma@codeaurora.org</a>>
            wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On
            7/3/2018 1:19 AM, Chandler Carruth via llvm-commits wrote:<br>
            > Author: chandlerc<br>
            > Date: Tue Jul  3 01:19:10 2018<br>
            > New Revision: 336178<br>
            ><br>
            > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=336178&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=336178&view=rev</a><br>
            > Log:<br>
            > [ADT] Disable the single callback optimization on
            Windows.<br>
            ><br>
            > It appears that the function pointer we use there isn't
            reliably 4-byte<br>
            > aligned. I have no idea why or how we could correct
            this, so for now we<br>
            > just regress the Windows performance some.<br>
            <br>
            I don't know why you'd expect functions to be aligned; x86
            doesn't <br>
            require any alignment. clang usually prefers to align
            functions to 16 <br>
            bytes because the instruction decoder fetches 16 bytes at a
            time, but it <br>
            won't align the entry point at all at -Oz.</blockquote>
          <div><br>
          </div>
          <div>I thought there was at least some ABI requirements, but
            I'm happy to add an explicit alignment attribute which
            should be sufficient outside of Windows?</div>
        </div>
      </div>
    </blockquote>
    <br></div><div text="#000000" bgcolor="#FFFFFF">
    The alignment attribute should work on most targets, yes... but it
    won't work on ARM or certain MIPS variants.</div><div text="#000000" bgcolor="#FFFFFF"><br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_quote">
          <div> </div>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">And even
            on platforms where <br>
            functions are aligned, function pointers might not be
            aligned; for <br>
            example, ARM uses the bottom bit for interworking.<br>
          </blockquote>
          <div><br>
          </div>
          <div>Yes, but I think we can just insist "don't use such
            function pointers here"?</div>
        </div>
      </div>
    </blockquote>
    <br></div><div text="#000000" bgcolor="#FFFFFF">
    I would guess most users of LLVM on ARM use Thumb2, since it's
    smaller (and therefore faster). So functions pointers will generally
    have the least significant bit set.  But we can work around that
    with some target-specific hacks if we control the callee.<br></div></blockquote><div><br></div><div>Yeah, control over the callee is key here. Let me know if I can help w/ making the thumb2 stuff work.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF">
    <br>
    Not sure about the details for MIPS.</div></blockquote><div><br></div><div>I'm happy to just fallback on the double indirection here similar to Windows. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><br>
    <br>
    -Eli<br>
    <pre class="m_6115844916611681071moz-signature" cols="72">-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project</pre>
  </div>

_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>