[llvm-bugs] [Bug 39060] New: WebRTC miscompile after ARMCodeGenPrepare was enabled

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 24 04:34:14 PDT 2018


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

            Bug ID: 39060
           Summary: WebRTC miscompile after ARMCodeGenPrepare was enabled
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: hans at chromium.org
                CC: llvm-bugs at lists.llvm.org, sam.parker at arm.com

Consider the following:

  typedef unsigned short uint16_t;

  uint16_t a = 0xFFFF;
  uint16_t b = 0;

  void f();
  void g();

  void test() {
    if (a != static_cast<uint16_t>(b-1)) {
      f();  // Shouldn't reach this point.
    } else {
      g();
    }
  }

With clang+llvm at r341931

$ clang -S -o - --target=arm-linux-androideabi -Oz /tmp/a.cc -mthumb
-march=armv7-a -mfloat-abi=softfp -mtune=generic-armv7-a -mfpu=neon

...
        ldrh    r0, [r0]
        ldrh    r1, [r1]
        subs    r0, #1    <--- subtract
        uxth    r0, r0    <--- truncate to 16-bit
        cmp     r1, r0    <--- compare
        it      eq
        beq     _Z1gv
        b       _Z1fv
...

At r341932:

...
        ldrh    r0, [r0]
        ldrh    r1, [r1]
        subs    r0, #1
        cmp     r1, r0
        it      eq
        beq     _Z1gv
        b       _Z1fv
...

The UXTH instruction has gone missing. The comparison will fail because it's
comparing 0xFFFFFFFF (32-bit -1) against 0xFFFF.


Chromium ran into this when running WebRTC tests on Android.

-- 
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/20180924/8d585f60/attachment.html>


More information about the llvm-bugs mailing list