<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/122551>122551</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[CodeGen] inefficient code for multiple select instructions with same condition
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
weiguozhi
</td>
</tr>
</table>
<pre>
The example test case is at https://godbolt.org/z/fEEonKhn9.
Function foo is what I got from source code, there are two selects in two basic blocks, they use the same condition, it generates two pairs of "test + jns" instructions. An optimal result should be same as function expected, there is only one pair of "test + jns".
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxsUs1unDAQfhpzGQXBALvZA4fND1XVa1_AwABOjWflGWeTPH0F3Spq1BNY4_l-_H1WxM2BqDXNg2meMpt04dheyc2JPxaX9Ty-tz8XAnqz68UTKInCYIXACViFRfUipjob7Ax2M489e805zga7D4Pd9PzM4ccSTrkpzqY4dykM6jjAxLxBXBer8B1mVpgiryCc4kAw8EgGH0EXigQ2EuiVQcjToAIu7Mfeihug9zz8ktvld0hC2w-IXTeYMLqNbhs7hZkCRask-_7FuijAExjE3ZfBB3gJYhDBBdGYdqmSwzkAX9St1kMkSV5BFk5-hP5GZAWmv87o7UKD0vip3wlw8O_AgXbS_3Pm2dhW46k62Yza8lgdmgaPhypb2uFYHbA-nHqs7akpmxGJyiPWeDwVx7puMtdigU1RlgVW9aGo8nsc6qkoe7ovS2qoN3VBq3U-9_513eLJnEiitkRsmjLzticvewsQA11hnxrErRSx3Zbu-jSLqQvvROUTRp36vT6PPNI3CqZ5AhdomtzgKOgeJEwcYU1e3dagPyH-88Bwdbp8SSxL0bdf2uV0SX0-8Gqw2xTcPneXyC80qMFu1y0Gu5ux1xZ_BwAA__8EyfaL">