<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/136059>136059</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [CIR] Upstream union support
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            ClangIR
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          andykaylor
      </td>
    </tr>
</table>

<pre>
    ### Overview
Upstream support for union types. This will build on the existing record type support, but unions have special layout requirements and need extra handling during lowering to LLVM IR.

### Suggested minimal test case
```
union U {
  int n;
  char c;
};

int f() {
  U u;
  return u.n;
}
```

### Existing incubator tests
clang/test/CIR/CodeGen/union.cpp
clang/test/CIR/CodeGen/union-array.c
clang/test/CIR/CodeGen/union-init.c
clang/test/CIR/CodeGen/union-padding.c

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMU81u3DwMfBr5QsTQyn_rgw9O8vlDgBQF0qZ3WaJttbLk6meTfftC3k2C3AIQlgjPjIYEyb1Xs0HsSHVLqvuMx7BY13Ejz3_4WVuXjVaeO8KKS8D3E7qTwhdC--fNB4d8BR-3zboAk3UQjbIGwnlDn8PPRXl4UVrDGJWWkP4sCPiqfFBmBofCOrmj30QIu4MxhouOh4WfEPyGQnENmp9tDODwb1QOVzTBAzcSDKIEfA2Ow8KN1ElaRpcObV9wvwQLj4-_vsHDU05on-K9pB9xntEHlLAqo1auIaAPILjHhKvpNWh_Ke4ZSHNLaA-gTABDiksiFu5AXDLS3F8vtE-gibAjYe078RniG81hiM5AzM0H9fOrn8z-99Y7ZUQcebBud-sJ7YXmZiZsSDlhw93DU_paif-jIWzYzedi274IveHO8XMuvgpXRoWvozcupTLzTshkV8i2aHmG3aEpy2PZVHWVLZ2c6po3UzEd2vJ4LFukgjWHijdUYts2ZaY6RllFy0PNioqVVY5tyeuatdVUCN5MNSkprlzpXOvTmls3Z8r7iN2hqGnVZpqPqP0-_IzdJd_JLEub4LpEuRnj7ElJtfLBf4gEFfS-M6m46h7eV-EyIddZzqLT3RLC5knREzYQNswqLHHMhV0JG5Lc9bjZnP2NIvVrN-gJG64eTx37FwAA__-VWya2">