<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/67698>67698</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LTO scan of module-level inline assembly does not respect CPU
</td>
</tr>
<tr>
<th>Labels</th>
<td>
LTO
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mysterymath
</td>
</tr>
</table>
<pre>
The scan of module-level inline assembly performed to extract the referenced symbols does not forward the CPU specified on the clang command line. Because of this, opcodes that are only legal in that CPU will cause the compile to fail in `-flto` where it would have succeeded without. For example:
```
asm(".globl func; func: cm.mvsa01 s1, s0; ret");
```
Succeeds when compiled for RISC-V without LTO with `-march=rv64izcmp` (https://godbolt.org/z/8dxT3nxs9), but fails when compiled with `-flto` (https://godbolt.org/z/GK5ohKnK9).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMU1tvmzAU_jXm5SjIMQTCAw9NIqaplTqt2d6NfQiefEG2yaW_fjJtOqnaQyWEwT7-bjqHh6BOFrElmx3ZHDI-x9H51txCRH8zPI5Z7-StPY4IQXALbgDj5KxxpfGMGpTVyiLwEND0-gYT-sF5gxKiA7xGz0WEOCJ4HNCjFSgh3EzvdADpMIB1EQbnL9zLpW7_4xeECYUaFEpwdtkUmtsTCGcMtxISYw47FHwOmBTFUQXC9uAm4SQGiCOPwD2Cs_oGGk88CX3bTvgXpTW83V7QnZmUxqR44GopJRVdDTo6UlG4jOgRVISLm7WEkZ8RwiwEokQJFxVHN8ccOucBr9xMGknxQOiB0Pu7ou_P8suDIWxLGMtP2vUahtkKUuze1wcQJjfnwOkawjq5CjSdeoyEMcIaUuz-C_vyJikkvfbuSaZs4ef3l_3q910qPB2fl-_FpeFejKQ4-HNVqldhpmSZsO0Y4xSSEdYR1p2c7J2OufMnwrpXwrqtvB4Lew1NksT20M9xSe8z_wfRPc4vYH973Ljx0T4m7DyTbSGbouEZtuuq2TTruqiabGy5pHXf1Nu1lFQgDiXd1oVY87Ksa940mKmWUVbQhm3XFW1YkddVScWmZptyKMteUlJSNFzpXOuzSfyZCmHGtqqrZptp3qMOy2Qw9nR8TvFvDplvU_Wqn0-BlFSrEMO_-1FFjW0K-EvT8jEBHlPPL92ZzV63nxJScZz7XDhDWJe43pfV5N0fFJGwbhEeCOsW7X8DAAD__3mYPsc">