<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/142347>142347</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
slp-vectorizer miscompile
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mikaelholmen
</td>
</tr>
</table>
<pre>
llvm commit: 9801fdf669b
Reproduce with: ```opt -passes="slp-vectorizer" bbi-107513.ll -S -o -```
Result:
```
define i16 @foo() {
entry:
%cond3 = select i1 false, i16 1, i16 0
ret i16 %cond3
}
```
The function should return the value 1, but with slp-vectorizer we get 0 instead.
This starts happening with d41e517748e
```
[SLP] Make getSameOpcode support interchangeable instructions. (#135797)
We use the term "interchangeable instructions" to refer to different
operators that have the same meaning (e.g., `add x, 0` is equivalent to
`mul x, 1`).
Non-constant values are not supported, as they may incur high costs with
little benefit.
---------
Co-authored-by: Alexey Bataev <a.bataev@gmx.com>
```
[bbi-107513.ll.gz](https://github.com/user-attachments/files/20547856/bbi-107513.ll.gz)
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8lN2OrDYMx58m3FigEL4vuJjd6Vz1S91KvQ7EQHpCQhMzu3Oevgrstj1b6YxGiiH4Z_vvxDIEPVvEnlVPrLomcqfF-X7VXySaxZkVbTI49eiNua8wunXVxIoLdC3PJzXVdTcwfvkNN-_UPiK8alriPqv5-XcbQbrJEDCw4sqECGZL7ziS8_oreiYEDINOc95UeZEZA-kLpA7SfwAHPuwmhmX88t_3CidtEXReAyv55BwTLRMdsOaJ8Qta8o_TCYCJanRWFcCKKwQ0OBLoHCZpAjLxfDDyD4MfLh7pRL-7xuDN9VMKvy8I025H0s5CWNxuVHTcvQVaEO7S7HiCh50OdeBbAeAVYUYCDtoGQqmyGCGCdYBA0lOARW4bWm3nE6DKHKu8acoWP2XDqqeXH39l1RV-kl8O7otc8ZdtdAoh7NvmPIG2hH5cpJ1RDgaPuH4_KggZHBIWeVE1XcNEdybzB8Ie8KiI0K_AhPgeJTaVHHic0EdD6WlCj5YYv7gNvSTnA9AiCRZ5P7lBrggryqNMJlrM5izKxmoulYK3aMcqQQfAv3Z9lwYtAblTgnU35zd5VEJ0UcWfnU1HZwNJS2cnAkiPYB19iIEq-siYDD5glQ_Qdtw9LHpeYHSBwnmi-cVoIoMwoMVJ03uT0o_f-fjs0vP-oEqHePTgYvANH_AkSeIdWPEss-GwWcnn9S0b3cqKHz538WjkN7cim7-y6spEuxBtIR5qcWPiNmta9uGgiNse0KeSSI7LipYCE7dJG4yr4FXZtFXNxO1_WNElqi9UV3QywT5vyratiqrhydIPbYnDJGU9TU1V56qVbdcpwatmUGNbV4nuBRcVr7ngbdEVPBvrSeS16spS1WJQgpUcV6lNFsdH5vyc6BB27PNSFGWTGDmgCcfsEcLiKxy7TIg4ivwxc9JhnwMrudGBwr8Y0mSw_3SVVh1Gt27aYLJ7039Hq8h5X9LNuz9xJCZuR_So13t69178HQAA__-IYJdj">