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

    <tr>
        <th>Summary</th>
        <td>
            [WebAssembly] ICE when using `__builtin_thread_pointer`
        </td>
    </tr>

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

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

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

<pre>
    `test.c`:
```c
void *f0(void)
{
 return __builtin_thread_pointer();
}
```
```console
$ /emsdk/upstream/bin/clang --target=wasm32 -o test.wasm test.c
fatal error: error in backend: Cannot select: intrinsic %llvm.thread.pointer
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 20.0.0git (https:/github.com/llvm/llvm-project 3a31427224d4fa49d7ef737b21f6027dc4928ecf)
Target: wasm32
Thread model: posix
InstalledDir: /emsdk/upstream/bin
Build config: +assertions
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/test-9adbd1.c
clang: note: diagnostic msg: /tmp/test-9adbd1.sh
clang: note: diagnostic msg: 

********************

```

Context: https://github.com/emscripten-core/emscripten/pull/21548.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVF9v4zYM_zTKC5FAppzYefBD0sR3BYq1uMtwj4Vs0YlWWQokOe19-0F2mm3Fbtg_wJApiqTIH6mfDEEfLVHFllu23M3kEE_OVy-GdJDDC80ap75XbMUjhbho2YozsWF8x_gmyePXTvuL0woYbjrOsEwbhuurZbGdBPAUB2_h-bkZtInaPseTJ6mez07bSJ5hmZzE9t1v9-Gqjzc7G5yhqxZzYFhTH9QLw3o4h-hJ9gzrRluGdWukPcJ8HqU_UmRi9ypDLxDmDsbi0hauZY4BOxmlAfLeeSY2kwDaQiPbF7I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