[llvm-bugs] [Bug 50421] New: clang does not optimize alignment checks

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 20 10:41:56 PDT 2021


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

            Bug ID: 50421
           Summary: clang does not optimize alignment checks
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: gonzalo.gadeschi at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Example: https://godbolt.org/z/G8j6dbG6T

    #include <cstdint>
    bool copy(int* out, int* in) {
        *out = *in;
        return (std::uintptr_t)in % 4 == 0;
    }

does not optimize the alignment check away:

copy(int*, int*):                            # @copy(int*, int*)
        mov     eax, dword ptr [rsi]
        mov     dword ptr [rdi], eax
        test    sil, 3
        sete    al
        ret

-- 
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/20210520/fb9b19ae/attachment.html>


More information about the llvm-bugs mailing list