Skip to content

LLVM does not generate correct code on arm #33931

Closed
@llvmbot

Description

@llvmbot
Bugzilla Link 34583
Resolution INVALID
Resolved on Sep 28, 2017 15:05
Version trunk
OS Linux
Blocks #24719
Attachments The pre-processed file., asm from the bad compiler, good_asm built by LLVM with that patch reverted.
Reporter LLVM Bugzilla Contributor
CC @stephenhines

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);

    int fds[GBM_MAX_PLANES];

    EGLint khr_image_attrs[37] ={12375, 2400, 12374, 1600, 12913, 875713112, 0};

    initStruct(self, bo, fds,  khr_image_attrs);

    size_t attrs_index = 6;
    for (size_t plane = 0; plane < gbm_bo_get_num_planes(bo) ;  plane++) {
            khr_image_attrs[attrs_index++] = EGL_DMA_BUF_PLANE0_FD_EXT + plane * 3;
            khr_image_attrs[attrs_index++] = fds[plane];
            khr_image_attrs[attrs_index++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT + plane * 3;
            khr_image_attrs[attrs_index++] = gbm_bo_get_plane_offset(bo, plane);
            khr_image_attrs[attrs_index++] = EGL_DMA_BUF_PLANE0_PITCH_EXT + plane * 3;
            khr_image_attrs[attrs_index++] = gbm_bo_get_plane_stride(bo, plane);
            if (self->use_dma_buf_import_modifiers) {
                    const uint64_t modifier = gbm_bo_get_format_modifier(bo);
                    khr_image_attrs[attrs_index++] =
                        EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT + plane * 2;
                    khr_image_attrs[attrs_index++] = modifier & 0xfffffffful;
                    khr_image_attrs[attrs_index++] =
                        EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT + plane * 2;
                    khr_image_attrs[attrs_index++] = modifier >> 32;
            }
    }

    khr_image_attrs[attrs_index++] = EGL_NONE;

    EGLImageKHR image =
        self->CreateImageKHR(self->display, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT,
                             NULL /* no client buffer */, khr_image_attrs);

    return image;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillainvalidResolved as invalid, i.e. not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions