<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64558>64558</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Missed transform: `(a & !b) ? a : b` into `a | b`
</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>
Kmeakin
</td>
</tr>
</table>
<pre>
[godbolt](https://godbolt.org/z/fE41Pd4oc), [alive](https://alive2.llvm.org/ce/z/seurTh)
```c
#include <stdbool.h>
bool src(bool a, bool b) { return (a & !b) ? a : b; }
bool tgt(bool a, bool b) { return a | b; }
```
```llvm
define i1 @src(i1 %0, i1 %1){
%3 = xor i1 %1, true
%4 = and i1 %3, %0
%5 = select i1 %4, i1 %0, i1 %1
ret i1 %5
}
define i1 @tgt(i1 %0, i1 %1){
%3 = or i1 %0, %1
ret i1 %3
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMU01vnDAQ_TXDxcrKjMG7HDjsR7hUlXroH7Dx7K5bgyPbRG1-fWUgu2katZUQDJ735vmNxypGexmJWqgPUJ8KNaWrD-2ngdR3Oxbam585dfFGe5egPgHurik9RRB7wA6wW1MbHy6A3Qtgd36syi-m8j1gA3hkUB-Us8_0EXtO4Ma552Gt0NNaJtIUvl5zDX4Cvl_fki9Pv_6jsGPvJkMMxDEmo713myuIx7esvMhi6AF3c6jytuZIAzYMtgcWKE1hZIA7xQAlAyyXnOiYYiD2TIM4MNie3pRMl_TvkorB9viOfbPxobfcjWXJ0NmOxGzJoOKLgRxjzbPcEpa5RdvDQmB5RTAQJ_bDhzviyFKY6A2mmjFqNCtGzCeVC98x9YyJ5KhPK6y66_62hZUU6BVYr55ujv_0s3Tvv_3c7PB1qx-oiveqry0tTCtMIxpVUFvKpqx35VaK4tqiQimrs-SaSGKzbfRZaCGx0RU1dU-FbZGj4DvelGXVIN_IkraG11wa0ygtOVScBmXdbYgLG-NErazqelc4pcnF-Xohzgcr9naMqfeDtiMBIuAREAcbI5kH_5TsYF9Usn7MufpUhDbTHvR0iVBxZ2OKd6lkk6P280xmKagxnn3IGiz7_tswS87smHzGvU6o5MUUXPvuftt0nfSm9wNgNxtYPg9PwX-jPgF2s98I2M2WfwUAAP__Vl0qqA">