[llvm-bugs] [Bug 33100] New: Miscompilation in arm64 backend

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 18 22:06:41 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33100

            Bug ID: 33100
           Summary: Miscompilation in arm64 backend
           Product: tools
           Version: trunk
          Hardware: Other
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: llc
          Assignee: unassignedbugs at nondot.org
          Reporter: human at apple.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18471
  --> https://bugs.llvm.org/attachment.cgi?id=18471&action=edit
Returns 0 when compiled correctly

I came across a miscompilation bug on arm64.  I reduced it to a small test case
that is successful when compiled with -O0 but miscompiles with -O1.

Repro steps:

$ llc -relocation-model=pic -mcpu=cyclone -disable-fp-elim -O0 -o
reduced_good.s reduced_test_case.ll
$ clang -arch arm64 -x assembler -o reduced_good reduced_good.s

Execute on any arm64 device:

$ ./reduced_good 
$ echo $?
0

$ llc -relocation-model=pic -mcpu=cyclone -disable-fp-elim -O1 -o reduced_bad.s
reduced_test_case.ll
$ clang -arch arm64 -x assembler -o reduced_bad reduced_bad.s

Execute on any arm64 device:

$ ./reduced_good 
$ echo $?
1

After disassembling both, the bad one shows several 32-bit operations which are
somewhat unexpected in a function with only 64-bit operations.  The unoptimized
assembly also uses only 64-bit operations.  Maybe the > 32-bit left shift
triggers a mistake in the optimization to overaggressively truncate some
values.

-- 
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/20170519/77496dec/attachment.html>


More information about the llvm-bugs mailing list