<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [11->12 regression] Improper assignment fusion"
   href="https://bugs.llvm.org/show_bug.cgi?id=50635">50635</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[11->12 regression] Improper assignment fusion
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>blubban@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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: <a href="https://godbolt.org/z/1W1oKdfcG">https://godbolt.org/z/1W1oKdfcG</a>

Found by user @fifty#1323 on Discord.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>