<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Miscompilations on AArch64 since "[SimplifyCFG] don't sink common insts too soon""
   href="https://bugs.llvm.org/show_bug.cgi?id=39550">39550</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Miscompilations on AArch64 since "[SimplifyCFG] don't sink common insts too soon"
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>martin@martin.st
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dberlin@dberlin.org, efriedma@codeaurora.org, llvm-bugs@lists.llvm.org, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21080" name="attach_21080" title="Reproduction code">attachment 21080</a> <a href="attachment.cgi?id=21080&action=edit" title="Reproduction code">[details]</a></span>
Reproduction code

I'm running into a case where code seems to miscompile after SVN r320749,
"[SimplifyCFG] don't sink common insts too soon (PR34603)" (part of LLVM 6.0,
but the same issues can be reproduced with the latest trunk version as well).

I can't (yet) point out exactly where the new generated code is wrong, but this
commit changed the outcome of the attached code.

To reproduce (somewhat), compile the attached sample with "clang -std=c99 -O3
-fvisibility=hidden -fomit-frame-pointer -ffast-math --target=aarch64-linux-gnu
-c ref_mvs-preproc.c". If compiled with clang built from before SVN r320749,
the compiled code does what it is supposed to, while if compiled with a later
version, it produces incorrect results.

I have tried looking at the output from compiling with `-mllvm
-print-after-all` to look at differences between before and after this commit,
and there obviously are differences, but nothing that I could spot that stands
out as obviously incorrect.

Surprisingly, the same code built for other architectures (both 32 and 64 bit
x86, and armv7) with newer clang/llvm versions run just fine without any of the
misbehaviour as I run into on AArch64.

Can someone spot what this SimplifyCFG change does wrt to this code sample, if
there's some overlooked case? Or are the transformations correct and it just
happens to trigger buggy codepaths in the AArch64 target after the
transformation?</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>