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: unassignedb...@nondot.org
          Reporter: blub...@gmail.com
                CC: htmldevelo...@gmail.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to