<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Arguments converted to WASM .S incorrectly by LLC"
   href="https://llvm.org/bugs/show_bug.cgi?id=27327">27327</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Arguments converted to WASM .S incorrectly by LLC
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: WebAssembly
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>gareth_morgan77@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16207" name="attach_16207" title="The input LL and output S">attachment 16207</a> <a href="attachment.cgi?id=16207&action=edit" title="The input LL and output S">[details]</a></span>
The input LL and output S

The attached .LL file will be incorrectly converted to .s by WASM back end.

Specifically on line 3566
%call16 = call zeroext i1
@_ZN22MarchingSquaresFunctorI4Vec414MSVec4AccessorE3RunERKiS4_(%class.MarchingSquaresFunctor*
nonnull %f, i32* nonnull dereferenceable(4) %i, i32* nonnull dereferenceable(4)
%j)


This gets converted to this code in the .s. Where the constants 4 and 8 are
passed in as addresses. These should be __stackPointer+4 and __stackPointer+8:
    i32.const    $18=, 4
    i32.add     $18=, $18, $18
    i32.const    $19=, 8
    i32.add     $19=, $18, $19
    i32.call    $discard=,
_ZN22MarchingSquaresFunctorI4Vec414MSVec4AccessorE3RunERKiS4_@FUNCTION, $1,
$18, $19

Compiled with following command line:
LLC Ashara.opt.ll -o Ashara.s -mtriple="wasm32-unknown-unknown"</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>