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

    <tr>
        <th>Summary</th>
        <td>
            [WebAssembly] assert in WebAssemblyAsmPrinter::getOrCreateWasmSymbol (thru Emscripten tot)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:WebAssembly
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            sbc100,
            dschuff
      </td>
    </tr>

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

<pre>
    Relevant part of stack trace:

```
#10 0x00007f75d24c59f7 llvm::WebAssemblyAsmPrinter::getOrCreateWasmSymbol(llvm::StringRef) WebAssemblyAsmPrinter.cpp:0:0
#11 0x00007f75d24c5def llvm::WebAssemblyAsmPrinter::emitDecls(llvm::Module const&) WebAssemblyAsmPrinter.cpp:0:0
#12 0x00007f75d24c8a97 llvm::WebAssemblyAsmPrinter::emitConstantPool() WebAssemblyAsmPrinter.cpp:0:0
#13 0x00007f75d0c6065c llvm::AsmPrinter::emitFunctionHeader() (/home/runner/emsdk/upstream/bin/../lib/libLLVM-17git.so+0x276b65c)
#14 0x00007f75d0c6341d llvm::AsmPrinter::emitFunctionBody() (/home/runner/emsdk/upstream/bin/../lib/libLLVM-17git.so+0x276e41d)
#15 0x00007f75d24c946b llvm::WebAssemblyAsmPrinter::runOnMachineFunction(llvm::MachineFunction&) WebAssemblyAsmPrinter.cpp:0:0
```

Full log: https://github.com/aardappel/lobster/actions/runs/5447367026/jobs/9909273184

This is with Emscripten `tot` as of today:

```
        git clone --depth 1 https://github.com/emscripten-core/emsdk.git $HOME/emsdk
 $HOME/emsdk/emsdk update-tags
        $HOME/emsdk/emsdk install tot
 $HOME/emsdk/emsdk activate tot
```

I don't have a small repro, sorry. You'd need https://github.com/aardappel/lobster/commit/c632eb77e2f8d6c3df4b67ce17b71067fdc0fd4c and build with the same steps as https://github.com/aardappel/lobster/blob/c632eb77e2f8d6c3df4b67ce17b71067fdc0fd4c/.github/workflows/build.yml#L116-L151

The function that it's unhappy with is `stbi_flip_vertically_on_write` which comes from https://github.com/nothings/stb/blob/master/stb_image.h which may allow a smaller repro.

Given the stack trace I would not be surprised if it turns out I originally caused the bug ;)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0Vltv2zwS_TX0y8AGRcqS9eCHXKptgQQt2sUW-xTwMpLYUKRAUnH97xe0nZuRDZKHz7BJSxRnzpk5M6KI0fQOcUvWl4SxKFVBKWGMsCvCmI5qmLsuX6-vF2JOgw9bIYIW04R2Ib3eb3-ixQfhEkwiJPAdxCTUPaQgFBJ-Qeg1oY9jRU_f4yXjBQX6l1JK665ea1aqddPVYO3DmLfyi98oL2LEUdr9RRx_BOMShuNSj-l7uAooEv4Wcfy1H6W3hG2eN_9Kwbj-J3aENfCmpZWaJsIv6OH3hKk4x6Sx-xgmHE26RmXjKxy3Xs8WQXkXE2HVJ9GwMzQb0XwwQhnNVXYqXPrhD8H5pG_-0jdVFa3W6oXvtxy2s1PJePcVhcZwcnmY2sGPSFgbZufySotj1PeEtfMUU0AxEtZK4whrVyvCWmvkcby5-c_tsqh7k1bRE3ZJ_7K6ktVaEdY8Qy3PoPKy0B-Eeun1_h8DimWhXwFdn-WzKSv5sXyG2X13t0INxuEj9tdCO1_7lNbOivMwtrO1YH1P-AUMKU0xO2ItYW1v0jDLlfI5Gk8tIQfCy5gOYRMHFPEYyTyty7LmVU0zrvaPl_le09CG1bzYlC_9_nswEUyEnUkDfBmjCmZK6IBUNPlEKgoi5l6TvBb797sMnD69SaCsdwjLpcYpDVC8RwmfnC6VD_ioglU2Q1j59fvtlydlHP2c3z3NME9aJFwm0cfXiP7fBpNL1lrITN83nSP8IBI-P_pmFr-BzmqoEwziAUFAHLP9gFPwhF1B9CHsV_BfPxNWa3CI-vPZVn4cTcp_Ks5Q1jWybqMrxXVXyqpWWNSyLmhVd1rRTpcKhN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