[llvm-bugs] [Bug 39550] New: Miscompilations on AArch64 since "[SimplifyCFG] don't sink common insts too soon"

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Nov 3 15:39:01 PDT 2018


            Bug ID: 39550
           Summary: Miscompilations on AArch64 since "[SimplifyCFG] don't
                    sink common insts too soon"
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: martin at martin.st
                CC: dberlin at dberlin.org, efriedma at codeaurora.org,
                    llvm-bugs at lists.llvm.org, spatel+llvm at rotateright.com

Created attachment 21080
  --> https://bugs.llvm.org/attachment.cgi?id=21080&action=edit
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

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181103/8107a109/attachment.html>

More information about the llvm-bugs mailing list