<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 03/29/2017 01:25 PM, Mehdi Amini wrote:<br>
    <blockquote
      cite="mid:414A089F-231E-4F45-8847-33CF4A24C729@apple.com"
      type="cite">
      <div>
        <blockquote type="cite" class="">
          <div class=""><span style="font-family: Helvetica; font-size:
              12px; font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; float: none; display:
              inline !important;" class="">the wrong precedence. The
              output is not defined to be in any specified</span><br
              style="font-family: Helvetica; font-size: 12px;
              font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px;" class="">
            <span style="font-family: Helvetica; font-size: 12px;
              font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; float: none; display:
              inline !important;" class="">order. </span></div>
        </blockquote>
        <div><br class="">
        </div>
        <div>I sympathize with this, and I’m OK with this change only
          because it is going from a random order to another, with a 3
          lines change. Anyone having a reason to change it to another
          order (i.e. not random) should be free to do so and not be
          locked by this change.</div>
      </div>
    </blockquote>
    <br>
    I'm happy to modify the comments to make it clear that this doesn't
    establish such a precedent. I think we all agree we don't want to
    enforce this in any way. But absent a better way of laying out data
    based on PGO, not changing the source order here - like we have
    always done in the past - is the best we can do. I feel this is what
    Gerolf's and Tim's comments imply also.<br>
    <br>
    <blockquote
      cite="mid:414A089F-231E-4F45-8847-33CF4A24C729@apple.com"
      type="cite">
      <div><br class="">
        <blockquote type="cite" class="">
          <div class=""><span style="font-family: Helvetica; font-size:
              12px; font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; float: none; display:
              inline !important;" class="">Anything trying to optimize
              the order should operate at a level</span><br
              style="font-family: Helvetica; font-size: 12px;
              font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px;" class="">
            <span style="font-family: Helvetica; font-size: 12px;
              font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; float: none; display:
              inline !important;" class="">lower than llvm IR.</span><br
              style="font-family: Helvetica; font-size: 12px;
              font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px;" class="">
          </div>
        </blockquote>
        <div><br class="">
        </div>
        <div>I think an LTO IR Pass that operate at the IR level should
          be OK as well. What’s wrong with that? It’s much more friendly
          than lower level (binary…) and better integrated with things
          like PGO. Also it makes the optimization independent of the
          linker.</div>
        <div>I’m not saying it is wrong to do it at the linker level as
          well, but I don’t see a problem with such an IR pass.</div>
      </div>
    </blockquote>
    <br>
    So this is a bit of an aside but I can think of a couple of reasons
    why it's not ideal to do layout on LLVM IR:<br>
    1) Linker scripts (I can hear you laugh... :)) - you essentially
    don't know which output sections things will eventually end up in
    and in which order until you're at the link stage.<br>
    2) Even without linker scripts, data is pulled apart into multiple
    sections (.data, .bss). Hexagon (and others) also have GP-relative
    addressing modes, so some small data will go to .sdata and .sbss.
    This is only known in the backend, past IR. <br>
    3) It won't work for ThinLTO because files are still essentially
    compiled individually so we don't have a way to reorder things
    globally (without moving globals between files).<br>
    <br>
    Tobias<br>
    <pre class="moz-signature" cols="72">-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project.
</pre>
  </body>
</html>