<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54694>54694</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[X86] Infinite loop in DAB combiner for targets with the fast-lzcnt feature
</td>
</tr>
<tr>
<th>Labels</th>
<td>
bug,
backend:X86,
tools:llc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
goussepi
</td>
</tr>
</table>
<pre>
```
define i32 @testmasks(i32 %0, i32 %1) {
%3 = and i32 %0, 131072
%4 = icmp eq i32 %3, 0
%5 = and i32 %1, 131072
%6 = icmp eq i32 %5, 0
%7 = select i1 %4, i1 true, i1 %6
%8 = select i1 %7, i32 1, i32 2
ret i32 %8
}
```
llc -mtriple=x86_64-pc-linux -mcpu=btver2 mask.ll -O3 -o -
.text
.file "lzcnt2.ll"
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtU8mSmzAQ_Rpx6YLSwuYDBzvUVOWUa24pAQ1WRkZEEhMnXx8Jm4njDKWC1tPr5bWazgy_GlLS-6ItoccBRzUjKMGB5NSj8xfpXh3h9QbxghL-Ce42I_wApDrdXCFCAohoQc4DPPKZYLTiD7R8o6n-sgD-2KkiUukDq3gOxj4MVn4UrHgOVm0shxp7D4ptVWxaGHi74t2M4R6c6v-dqr0BbDfea7Ho9_T1DSNVezf-bfPtrXUP6cVbtWgMea51-a3M06VPtZrXazjqlzXgnX9DyyFeRKY1pF8EpAbSPevtyTxe_RM0Ko0QdXD9u589D97BvpGSoRHDQRxk4pXX2JDi9LUuSdHC5zmMgPII2pgF1Azt8QS9uXRhMCyMxoKXdkLv4KfyZ_BnhFE6n245YETpV4vJanVz9n5xRBwJfwlrCuy1y0KksNH6bf-kizXfQ3_DVjm3Yhi2lyIvD3lybhBZwYpuqLuyljiOYhhEjbTgjPWVHA6Jlh1qF6sPyrp1ivrCtcSN7F9xHkL6qOsd9sboWFPofQSLNlENp5zTnDLGcsrLrGd1zXpR0KqrDtjl4UfAi1Q6i9Vmxk6JbbbCQz4XDrVy3v09lM6pacatpTG-XP3Z2GYyq3O4qGQT2WwK_wBujvaL">