[llvm-bugs] [Bug 36729] New: Chromium miscompile after r326991

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 14 07:24:25 PDT 2018


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

            Bug ID: 36729
           Summary: Chromium miscompile after r326991
           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: craig.topper at gmail.com, llvm-bugs at lists.llvm.org

I don't fully understand the root cause here, but this what I've got so far.

After r326991, a large unit test in the Chromium Fuchsia port started failing.
The way this test runs is complicated (runs in some sort of emulated
environment) and I'm not familiar with it, so I'm not sure exactly what's going
wrong. I think something is crashing, but it's hard to tell from the logs.

(Example failed build here:
https://ci.chromium.org/buildbot/tryserver.chromium.linux/fuchsia_x64/86148)

Luckily, there's only a single function whose machine code changes after
r326991: Skia's grayA_to_rgbA_portable. I've verified that if I put
__attribute__((optnone)) on that, the tests pass.

Here's a mostly stand-alone repro to show the difference:

#include <stdint.h>

static void grayA_to_rgbA_portable(uint32_t dst[], const void* vsrc, int count)
{
    const uint8_t* src = (const uint8_t*)vsrc;
    for (int i = 0; i < count; i++) {
        uint8_t g = src[0],
                a = src[1];
        src += 2;
        g = (g*a+127)/255;
        dst[i] = (uint32_t)a << 24
               | (uint32_t)g << 16
               | (uint32_t)g << 8
               | (uint32_t)g << 0;
    }
}
void grayA_to_rgbA(uint32_t dst[], const void* src, int count) {
    grayA_to_rgbA_portable(dst, src, count);
}

$ diff -u <(/work/llvm.combined/build.release.good/bin/clang++ -fPIC -m64
-march=x86-64 -fomit-frame-pointer -O2 -std=c++14 -x c++ -c /tmp/SkOpts.ii -S
-o -) <(/work/llvm.combined/build.release.bad/bin/clang++ -fPIC -m64
-march=x86-64 -fomit-frame-pointer -O2 -std=c++14 -x c++ -c /tmp/SkOpts.ii -S
-o -)


The diff shows a PSHUFD going missing in the new version, the rest of the diff
is just register names. I haven't dug into the assembly enough to tell why this
is breaking anything.

Craig, does this make any sense to you? Was your change supposed to alter
codegen or was it just reorganizing the code?

-- 
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/20180314/d81adec3/attachment.html>


More information about the llvm-bugs mailing list