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

    <tr>
        <th>Summary</th>
        <td>
            [CIR] Upstream support for volatile variables
        </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 handling the `volatile` qualifier on variables and parameters in ClangIR.

The clang AST contains information indicating when volatile handling is required. This task involves updating the existing load and store handling to set the volatile attribute when required.

The existing code has the following placeholders where changes are needed.

` assert(!cir::MissingFeatures::opLoadStoreVolatile());`
` assert(!cir::MissingFeatures::aggValueSlotVolatile());`

Additional changes will be required.

### Suggested minimal test case
```
int test_load(volatile int *ptr) {
  return *ptr;
}

void test_store(volatile int *ptr) {
  *ptr = 42;
}
```

### Existing incubator tests
clang/test/CIR/CodeGen/volatile.cpp
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUlM2O2zYQx5-Gugxi0KTktQ86aLN1EaBFgew212IkjqVpaFIhKbn79gXltZwtihYBCBsckr_5z4cGY-TeEdWiehTVU4FTGnyo0ZnXr_hqfShab15rofR1wW8zhZnpImTz-xhTIDxDnMbRhwQnH2BAZyy7HtJAIHZy9hYTWxI7Cd8mtHxiCuAdzBgYW0sR0BkYMeCZEoUI7OCjRdd_-rwRshGyeRkIumyB5vkFOu8Sssv3Tj6cMbF3wM5whyn7vQzk4Ob1LocjBPo2cSCzgZeBIySMX4Hd7O1MEabRXN9n3fQXx2VjPZpFX0w-fEdLHiKl5e7qClMK3E6JrhJWb_cgVmznTYbFBXDy1vpLNo8WOxq8NTkNl4ECQTeg63OOAoEjMisv5xNjpJCE2gu17TgI3Qjd_MoxsuuPhGkKFK9GP_7i0TznIL7cCpKfHfLSj2InfxiJff8F7UTP1qf_YMqmMYZzkdCu0VzYWmjpnzm6d9nz1PcUExk4s-MzWkgUE3QY6Sr0bcmGXVrO_silEmq_liMfCNWMKQh1APHwKGQDEChNwd0OdDaKh6er-9mzubKWav8_7GoBoZ-gVO9g3wl8F9dPtw5g100tJh8Wh1HIZulwoY55L9Tx46fP-dcb-pmcUMeblE03joWptTnoAxZUbx-qSmr5sNfFUOOp3OOuVBq3u221o71C0uWprEi1B0llwbWSqpL7rVJSa6k3e6n17nAqtwdZaV2iKCWdke3G2vm88aEvOMaJ6m2l1V4WFluycRkWSr19pUKpPDlCnZ98aKc-ilJajineIYmTXWZMDqt6gn8dHWu219FQTMHWQ0rj0nPqKNSx5zRM7abzZ6GOmf_292EM_k_qcuoWxVGo45vouVZ_BwAA__8Hn5fA">