-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LLVM does not generate correct code on arm #33931
Comments
The patch that introduces this problem is commit f41c3c9 (HEAD)
|
Commit f41c3c9 merely enables instruction scheduling to happen when no -mcpu is specified. Therefore, the most plausible explanation seems to be that this uncovers a latent bug somewhere else in the compiler. I compiled the preprocessed file with the command line options listed above, both for revision f41c3c9 (r306514 in SVN-speak) and f41c3c9^ (r306513 in SVN-speak). Apart from the expected slight difference in instruction scheduling, register allocation and spill/fill code, there didn't seem to be any differences. One wild guess is the slight difference I noticed on the following instruction sequences: r306513: With both labels LCPI6_1 and LCPI6_2 involved somehow in the stack guard checking: Could it be that the __stack_chk_guard mechanism isn't robust in the face of instruction scheduling? |
Hmmm looking a bit closer at the code difference I marked in my previous comment, it doesn't look problematic to me after all. I notice the function that is claimed to be miscompiled also calls quite a few other functions. It is possible the miscompile is actually in any of those other functions? |
It seems the bug is not related to the CL I mentioned before. The vanilla (good) compiler also makes the test fail if I split the function. In addition, if I add a printf-like function call in the splitted function, the test passes. |
Turns out to be a source code problem. |
Extended Description
We found a LLVM change makes one of our test fail.
https://bugs.chromium.org/p/chromium/issues/detail?id=758878&q=owner%3Ame&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified
The mis-compiled function is show below. If I remove the assertions at the beginning of this function, the test passes.
I put the pre-processed code in the attachment.
The command line to compile the code is
/usr/bin/clang --sysroot=/build/kevin -Qunused-arguments -grecord-gcc-switches -fstack-protector-strong -pie -fno-omit-frame-pointer -D_FORTIFY_SOURCE=2 -mthumb -c -MD -MF bsdrm/src/egl.pic.d -O2 -O2 -pipe -march=armv8-a+crc -mtune=cortex-a57.cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard -g -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -I/build/kevin/usr/include/libdrm -DEGL_EGLEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES -Wall -Werror -fno-strict-aliasing -Wformat=2 -fstack-protector-strong -fvisibility=internal -ggdb3 -Wa,--noexecstack -O2 -std=gnu99 -I/build/kevin/tmp/portage/chromeos-base/drm-tests-0.0.1-r100/work/drm-tests-0.0.1/bsdrm/include -I/build/kevin/usr/include/libdrm -DEGL_EGLEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES -DUSE_ATOMIC_API -D_FORTIFY_SOURCE=2 -fPIC -o a.e test.i -B/usr/libexec/gcc/armv7a-cros-linux-gnueabi -target armv7a-cros-linux-gnueabihf -mfloat-abi=hard
EGLImageKHR bs_egl_image_create_gbm(struct bs_egl *self, struct gbm_bo *bo)
{
assert(self);
assert(self->CreateImageKHR);
}
The text was updated successfully, but these errors were encountered: