<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><font size="-1">Bug 37728 - [meta] Make llvm passes debug info
        invariant<br>
        <a class="moz-txt-link-freetext" href="https://bugs.llvm.org/show_bug.cgi?id=37728">https://bugs.llvm.org/show_bug.cgi?id=37728</a><br>
        <br>
        Further discussion on methods.<br>
<a class="moz-txt-link-freetext" href="https://groups.google.com/g/llvm-dev/c/yvbWr4azdh0/m/gy1tQIzIDwAJ">https://groups.google.com/g/llvm-dev/c/yvbWr4azdh0/m/gy1tQIzIDwAJ</a></font></p>
    <p><font size="-1">Neil Nelson</font></p>
    <div class="moz-cite-prefix"><font size="-1">On 12/29/20 7:25 AM,
        陈志伟 via llvm-dev wrote:</font><br>
    </div>
    <blockquote type="cite"
      cite="mid:36C34F6F-0E7C-42FA-A9FA-8B20EC828D49@kuaishou.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div class="">Hi folks, it’s my first post in llvm-dev mailing
        list, and definitely not the last :-)</div>
      <div class=""><br class="">
      </div>
      <div class="">Recently, I found an elf file built with or without
        debug info has different machine code generated. Sadly, it
        cannot be reproduced in a piece of code. Here is my
        investigation.</div>
      <div class=""><br class="">
      </div>
      <div class="">> clang -S -emit-llvm <a href="http://foo.cc"
          class="" moz-do-not-send="true">foo.cc</a> -O3 -ggdb3 -o
        dbg.ll</div>
      <div class="">> clang -S -emit-llvm <a href="http://foo.cc"
          class="" moz-do-not-send="true">foo.cc</a> -O3 -o rel.ll</div>
      <div class=""><br class="">
      </div>
      <div class="">Where <a href="http://foo.cc" class=""
          moz-do-not-send="true">foo.cc</a> is a cc file in my company
        of 10k+ LOC and depends on tons of 3rd libraries.</div>
      <div class=""><br class="">
      </div>
      <div class="">The difference between dbg.ll and rel.ll are the
        llvm debug intrinsics. Emmmm, looks fine.</div>
      <div class=""><br class="">
      </div>
      <div class="">> llc dbg.ll -o dbg.s</div>
      <div class="">> llc rel.ll -o rel.s</div>
      <div class=""><br class="">
      </div>
      <div class="">And the asm instructions are the same. Emmm, fine
        again.</div>
      <div class=""><br class="">
      </div>
      <div class="">> llvm-mc -filetype=obj dbg.s -o dbg.o</div>
      <div class="">> llvm-mc -filetype=obj rel.s -o rel.o</div>
      <div class=""><br class="">
      </div>
      <div class="">The 2 obj files generated by LLVM assembler has
        DIFFERENT machine codes.</div>
      <div class=""><br class="">
      </div>
      <div class="">> 74 19                      je f20</div>
      <div class=""><br class="">
      </div>
      <div class="">The obj compiled with debug info use 0x74 to
        represent a JE instruction, while</div>
      <div class=""><br class="">
      </div>
      <div class="">> 0f 84 15 00 00 00   je f20</div>
      <div class=""><br class="">
      </div>
      <div class="">The obj compiled without debug info use 0x0f 0x84
        instead.</div>
      <div class=""><br class="">
      </div>
      <div class="">What? Why the debug info affects the generation of
        machine code? As a LLVM beginner, I’m willing to dive deeper to
        find the root cause. </div>
      <div class=""><br class="">
      </div>
      <div class="">Thanks in advance.</div>
      <div class=""><br class="">
      </div>
      <div class="">
        <div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0,
          0, 0); letter-spacing: normal; text-align: start; text-indent:
          0px; text-transform: none; white-space: normal; word-spacing:
          0px; -webkit-text-stroke-width: 0px; text-decoration: none;
          word-wrap: break-word; -webkit-nbsp-mode: space; line-break:
          after-white-space;" class="">
          <div dir="auto" style="caret-color: rgb(0, 0, 0); color:
            rgb(0, 0, 0); letter-spacing: normal; text-align: start;
            text-indent: 0px; text-transform: none; white-space: normal;
            word-spacing: 0px; -webkit-text-stroke-width: 0px;
            text-decoration: none; word-wrap: break-word;
            -webkit-nbsp-mode: space; line-break: after-white-space;"
            class="">
            <div>--</div>
            <div>Zhiwei Chen<br class="">
              <br class="">
            </div>
          </div>
        </div>
      </div>
      <br class="">
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
    </blockquote>
  </body>
</html>