<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/126056>126056</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[InstCombine] Failure to recognise a split i128 extension
</td>
</tr>
<tr>
<th>Labels</th>
<td>
llvm:instcombine,
missed-optimization
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
RKSimon
</td>
</tr>
</table>
<pre>
Split off from #76524
https://alive2.llvm.org/ce/z/4SwMjF
```ll
----------------------------------------
define i128 @src(i32 noundef %x) {
%coerce.sroa.0.0.extract.trunc = sext i32 noundef %x to i64
%ashr = ashr i32 noundef %x, 31
%coerce.sroa.2.0.extract.trunc = sext i32 %ashr to i64
%x.sroa.2.0.insert.ext.i = zext i64 %coerce.sroa.2.0.extract.trunc to i128
%x.sroa.2.0.insert.shift.i = shl nuw i128 %x.sroa.2.0.insert.ext.i, 64
%x.sroa.0.0.insert.ext.i = zext i64 %coerce.sroa.0.0.extract.trunc to i128
%x.sroa.0.0.insert.insert.i = or disjoint i128 %x.sroa.2.0.insert.shift.i, %x.sroa.0.0.insert.ext.i
ret i128 %x.sroa.0.0.insert.insert.i
}
=>
define i128 @tgt(i32 noundef %x) {
%xx = sext i32 noundef %x to i128
ret i128 %xx
}
Transformation seems to be correct!
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUlNuOmzAQhp9muLGCzJhDcsEFuylSVfWm2xdwzJB4BXZkm126T1_hTfaUPbRRhEF4vv-fYTzSe703RDUUV1BsEzmFg3X1rx83erQm2dnuT31zHHRgtu9Z7-zIAEVVFpgDb4A3hxCOHkQD2AK2ctB3hOkw3I2pdXvAVhFg-wDY5jf3P2_bxyAo-eN_GIA3q3_8AW866rUhpjNcM8i5dwpwrQUyYyfTUc8Aixlww6C6At6w5VlZcopS76xMecpTmoOTKqTBTUYxEFvmaQ7sLYUFy3SZnynSH1zcHG8uJa-ZyJa9bwTxc8Ez-FlroT2HauPJhYWQ6hj5ECPL_GudBZnh-kOmP-j-TPWHgZnp_lTXDx0sWb51yf_H5WX533X5gnleItY61ml_a7UJn1g9JbaY_dhm_KyOLjjvSC_9Wm2Xq9iC-HbZhWEfvu7Cef6i1U5VeG1qfhL_7aTxvXWjDNoa5olGv8TtiCnrHKkAmL08WsCbpKtFtxEbmVCdVWK9zvMqF8mhzlFhRZKLrJCZVH0vCtVhUVVZiZ2QlOgaORYceZkhFrlIcaPWCotSbFRFGeeQcxqlHp6OeqK9n6jOsORFmQxyR4OPQwVx2QKi0cYHZcedNgSIgNeAOGrvqVvZY9CjfoipLe-KbeLqJWy1m_Yecj5oH_yzVtBhiCPru_Hh-sQstqyVepgcLXVxpOzeaE9MMh8HWCwqzYGM19Ykkxvq18Nrr8Nh2qXKjoBtNP24rI7O3sYCtzFJD9ie8ryr8W8AAAD__0nAlXM">