<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57474>57474</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[DAG] extractShiftForRotate - Assertion `(OppShift.getOpcode() == ISD::SHL || OppShift.getOpcode() == ISD::SRL) && "Existing shift must be valid as a rotate half"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
llvm:codegen,
crash
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
RKSimon
</td>
</tr>
</table>
<pre>
Pulled out of #57283
```
define void @f() {
BB:
br label %BB1
BB1: ; preds = %BB
%A = alloca <1 x i16>, align 2
%L1 = load <1 x i16>, <1 x i16>* %A, align 2
%I = insertelement <1 x i16> %L1, i16 -1, i16 0
%B6 = add <1 x i16> %I, %I
%B3 = srem <1 x i16> %B6, %I
%B1 = add <1 x i16> %B3, %B3
%B5 = sdiv <1 x i16> %B1, %I
%B4 = udiv <1 x i16> %B3, <i16 -32768>
%B2 = or <1 x i16> %B4, %B5
%B = lshr <1 x i16> <i16 -32768>, %B2
store <1 x i16> %B, <1 x i16>* %A, align 2
ret void
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVNtu3CAQ_Rr8grIy4OuDH-w4aaNGSpX9AjCsTcWaFeAo_fsC3m23WVdqLCTPDHPODMMMTPOfzfdFKcGhXhzUBwgwyUtcEZD2IG1BkZ5XVLk4yFnANy05BFl6ALgCuIag7Nb9rgOkXUUImYGKMqE8Zd516Ex49kPeEX7qA6SDJyO49VK_cl4ieaWNVqqUHqgX7xF8hxIVgDwAfO_tcpwhvvJ_RhGgNOW37h8MbQywzfMUaeRshXFCiaOY3d_wNVgAex3e_ZbSK5KuWLPn_Bb7FBMK_yt_Ev2tEcdbQFdsIdC_I3TkDOjINSJfY3D5tgFBWzGyiFi2EeRc2FgFgsuiCrW9QuOI1mYDm10SzK8B6wXa6QbxMcgZ_PvarNNGbIT5zNUb4eIYnLu67D_MSyIaVBSoziqSVwlvCK9JTRMnnRINyLu-_QLyHop3Z-jg9pM8uEdtXrWjTsA72NrQUFLPMNDh6uV0ij67UbiX06C5uIwe6UMZnvZ9mDzS7r8--3G89wv-P-b1OZqx7xzfiRg_vEvr5DxCG_DwuFgHmR97XwMOqYUUmjXRiSr_BuBkMaqZnDvZQIgf_Rqlmxa2G_TRK0q9XX53J6N_iMF5VVq7COuFvMzKLJkawXDBschKXtHCP0OMs-JA6jpN65wdaJ7E58SG8vmgkZS04VyjmL1hvWc8GGqnoOZ9IhucYpxWBCGMalTtcMkYH_Ka8RLhmgn_iIkjlWoX2HbajIlpYppsGa3fVL4Q9s8mtdZ3gYg3GPjp4iZtmtdve3nUcxJP1MTj_ALOWGGs">