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

    <tr>
        <th>Summary</th>
        <td>
            clang-20 crashed with optnone attribute at -O1 and above. error in backend: Cannot select: intrinsic %llvm.expect.with.probability.
        </td>
    </tr>

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

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

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

<pre>
    clang-20 crashed with ```optnone``` attribute at ```-O1``` and above.

Compiler explorer: https://godbolt.org/z/4dP5xGxnx

```
$cat mutant.c
int a;
void __attribute__((optnone)) b() {
  int c = __builtin_expect_with_probability(a, 0, 0.8);
}

Also crashed on clang-19.

$clang-19 -O1 mutant.c
fatal error: error in backend: Cannot select: intrinsic %llvm.expect.with.probability
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Ubuntu clang version 19.0.0 (++20240722031324+65825cd5431c-1~exp1~20240722151445.1819)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin
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/mutant-b18d19.c
clang: note: diagnostic msg: /tmp/mutant-b18d19.sh
clang: note: diagnostic msg: 

********************
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVU1v4zYQ_TX0ZWBBpCRbOuhgJ1E2QFAHu170KFDkxGZLkQJJeZ0e9rcXlD_iDVCg7S4g0OJoOM_vzQe592pnEGtSrElxP-Nj2FtXK95zY81bb0cv_Kyz8q0WmpvdnKUgHPd7lPBNhT2QRXp67BCMNXjdAw_BqW4MCDy8u8039MbFSOCdPWBC0nuSrk7rne0HpdEBHgdtHTqSrWAfwuBJtiKsIazZWd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