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

    <tr>
        <th>Summary</th>
        <td>
            [WebAssembly] LLVM IR add does not compile to wrapping Wasm 
        </td>
    </tr>

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

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

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

<pre>
    https://godbolt.org/z/6ETzMh11h

This LLVM uses `add` to add -4 to a symbol, but the Wasm, as I read it, has the $base as -4 and $offset as the symbol, this will not wrap whereas the semantic for LLVM `add` should wrap.

Compiling with `O1` creates the correct Wasm:

https://godbolt.org/z/5W8rEMs5q


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEUk1v3CAQ_TX4gnZlxt8HH7ZJLEVKVKmKmjOY8UKFzZbBsTa_vsKbKlEvvQDDzBvePJ4ksucFsWfVN1bdZ3KNxof-6jeXKa-vvYnxQqw4MRgYDGevlXfx6MOZwfDOYKgfXt6fjRCG5fcsP93WF2OJPz39fOYrIXFW51JrVuc8ei615odyP3G6zso7BndcrZFHg_xV0pxiSfyRB5Sa25hiI2nPMyiVJEz5Q8nlotONnybCyD9KPpvGRGOzzvHFR74FeeGbwYB_C3GWS7Qjn3y4sf0kSsavTu-Y49fJ7vx8sc4uZ77ZaBLgu0j1Y0AZ8dZ39CHgGG-zFKev8P-pWb224eGZqt9fQZnuC90VncywFw00XVOUoshMrxpVjVNTtRNOousa0FBUuRRQYYkKy8z2kEMp8rwQdVFXxRE6qLtWgq5GgBZaVuY4S-uOzr3NiUdmiVbshRC5aDMnFTravQGw4Mb3LANIVgl9Ah3UeiZW5s5SpM820Ua3m-oV1YkIZ-WurLq_yfz4Y3eB9kj7z4y7qJg8kQS_JHmTeDxbg_vXgTaaVR1HPzMY0nMf2-ES_C8cI4NhJ0kMho8p3nr4EwAA__8MUedt">