[llvm-bugs] [Bug 50635] New: [11->12 regression] Improper assignment fusion

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 9 01:20:20 PDT 2021


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

            Bug ID: 50635
           Summary: [11->12 regression] Improper assignment fusion
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: blubban at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

To reproduce:

#include <stdint.h>

struct S1 {
  uint8_t val1;
  uint8_t this_gets_clobbered;
  uint16_t val2;
};

void test(S1 src, S1* dest) {
  dest->val1 = src.val1;
  dest->val2 = src.val2;
}

Compile with -O1 or higher, with Clang 12.0.0 or higher (codegen is proper on
11.0.1).


Expected result:

test(S1, S1*):                          # @test(S1, S1*)
        mov     byte ptr [rsi], dil
        shr     edi, 16
        mov     word ptr [rsi + 2], di
        ret


Actual result:

test(S1, S1*):                          # @test(S1, S1*)
        mov     dword ptr [rsi], edi
        ret


Compiler Explorer: https://godbolt.org/z/1W1oKdfcG

Found by user @fifty#1323 on Discord.

-- 
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/20210609/24092510/attachment.html>


More information about the llvm-bugs mailing list