<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Assertion failure in WebAssemblyRegisterInfo::eliminateFrameIndex()"
   href="https://bugs.llvm.org/show_bug.cgi?id=47944">47944</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failure in WebAssemblyRegisterInfo::eliminateFrameIndex()
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>11.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>jjorge@quarkslab.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24091" name="attach_24091" title="Output of the crash">attachment 24091</a> <a href="attachment.cgi?id=24091&action=edit" title="Output of the crash">[details]</a></span>
Output of the crash

With clang compiled from the release/11.x branch, when compiling the reduced
test case below for the wasm32 target with

clang -target wasm32 -c test.ll  -o /dev/null

Where test.ll is

target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"

@str = hidden local_unnamed_addr global [3 x i8] c"abc", align 16

define i8 @failing() {
0:
  %1 = alloca i8, align 4

  %2 = ptrtoint i8* %1 to i32
  %3 = getelementptr [3 x i8], [3 x i8]* @str, i32 0, i32 %2
  %4 = load i8, i8* %3, align 8
  %5 = and i8 %4, 67

  ret i8 %5
}

Clang fails with the following message:

llvm/include/llvm/CodeGen/MachineOperand.h:536: int64_t
llvm::MachineOperand::getImm() const: Assertion `isImm() && "Wrong
MachineOperand accessor"' failed.

The call to getImm() is done at line 105 of WebAssemblyRegisterInfo.

See the attached log for details.</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>