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

    <tr>
        <th>Summary</th>
        <td>
            Fails to optimize ldadd to stadd
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    The following code:

```c++
void inc(std::atomic<uint32_t>* p) {
    p->fetch_add(1, std::memory_order_relaxed);
}
```

discards the result of the atomic rmw add operation. 

It generates an ldadd instruction, but I'd expect it to generate an stadd instead. 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcks1urDwMhq_GbKyOgjMwsGDRv5G6__ajQAzkUyAoMf27-qNMpz3VkaxEif2-epzYpOSmlbmD6gGqp8LsMofYTWH9ND70U9EH-9H9NzOOwfvw5tYJh2AZ9D2oJ1Dfa62-YgB6yHG9fQ3OolsHoCaJzRJ9byQsbgD9uLtVNF0E9DPQPW5ALcLppkRE3O5AP48sw3wx1gI1JdAj_hgtvIT4cQnRcrxE9uadLVAL-mYBp6d_2H4DW5cGE21CmRkjp90LhvF6-iLEuLyhsRbDxtGIC-sBfxu8CE685hQnNCt6m4vdmiTuQy7PsP0u-AJ0ssjvGw-CTlDCjzDrknzr2NgDFrbTttWtKbgr6_ZUV01Nqpi7hnpdDqYxx6a2qh57VurYqJF0W1dWqcJ1pEiXqmzKtlKkDu1YnvSom-NIxnDVwFHxYpw_eP-6HEKcCpfSzl3dVkoX3vTs03UMiFZ-w2sSiPJUxC5r7vp9SnBU3iVJf13EiefubJxPubmwiVvcJ99eRMJXi8UefTeLbCl_H52BzpOTee8PQ1iAztnutt1tMfzPgwCdrxAJ6HyF_BMAAP__m6bTsA">