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

    <tr>
        <th>Summary</th>
        <td>
            Wasm missing static address offset in some cases.
        </td>
    </tr>

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

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

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

<pre>
    llvm fails to add static offset address to memory load instructions in some cases.

Here is godbold link that demonstrates the issue:
https://godbolt.org/z/47PbT4669
The function "get_YY" should load value from memory address having static offset of 20, like all other functions in example.
Instead, it adds 20 to existing memory address by arithmetic operator.
All other load instructions that have offset less than 20 are using static offset as seen in godbold output.

The llvm code itself is correct:
`define hidden float @_ZN7example6get_YY17h71095c69e6bab6acE(%"Vec4<Vec4<f32>>"* noalias nocapture noundef readonly align 4 dereferenceable(64) %v) unnamed_addr #0 !dbg !23 {
  %0 = getelementptr inbounds %"Vec4<Vec4<f32>>", %"Vec4<Vec4<f32>>"* %v, i32 0, i32 1, i32 1, !dbg !24
  %1 = load float, float* %0, align 4, !dbg !24
  ret float %1, !dbg !25
}`
Link to llvm output: https://godbolt.org/z/z4ehToarG

When same struct is refactored to have five component, it works on offset 20, but does not work on offset 24. So it seems problem is always on the second component on second vector.
https://godbolt.org/z/Meq858KWq

The issue occurs only when targeting to WASM, the X86 instructions are fine https://godbolt.org/z/sx67bW7dv
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNVdtu2zgQ_Rr5haghUzf7QQ9u0u4uekGBBuvtvgQUObK0oUiXpJykX78zlJw4LooU0IXiZebMmTOjxqrHWuvjwFrRa8-CZUIp5oMIvWS2bT0EmnHg4-IAg3WPTFuhWG98cKMMvTUeP5i3AzApPPhlkl4n6XZ6_gkOWO_Z3qrGasV0b-5Y6ERgCo2RDREAjXe0y4-QZPPBLoSDpy_-Hq_peF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