<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63896>63896</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Failure to optimize based on umax implication
</td>
</tr>
<tr>
<th>Labels</th>
<td>
llvm:optimizations,
missed-optimization
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nikic
</td>
</tr>
</table>
<pre>
https://alive2.llvm.org/ce/z/o_8ch3
```llvm
define i1 @src(i8 %x, i8 %y) {
%max = call i8 @llvm.umax.i8(i8 %x, i8 1)
%cmp = icmp ugt i8 %y, %max
br i1 %cmp, label %if, label %end
if:
%cmp2 = icmp ugt i8 %y, %x
ret i1 %cmp2
end:
ret i1 false
}
define i1 @tgt(i8 %x, i8 %y) {
%max = call i8 @llvm.umax.i8(i8 %x, i8 1)
%cmp = icmp ugt i8 %y, %max
br i1 %cmp, label %if, label %end
if:
ret i1 true
end:
ret i1 false
}
declare i8 @llvm.umax.i8(i8, i8)
```
This might be either for ConstraintElimination or InstCombine.
For the case where `icmp ugt i8 %y, 1` is used, CVP/LVI could also handle this.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VE2Pm0gQ_TXFpTQICoPhwGHGXqSR9rCH1VyjpimbShra6m4mM_PrIzCxPfm6RIlkmf6oeq_eKyjlvRxH5hryB8j3kZpCb109yifRUWu717oP4eQhuwdqgBpl5JkpNuZ5iK07AjWagZo3oMZ-KHWfQbKH5B6K5PybA89HHR9kZJQUYZN4p4FKKREofwHa4Xn5ClQhbB_OGTgfDeoFIdujVsYsUZsFM54G9RJL-R1KClSt6UC5Hk5LtsyL6RiuPLsV_CtV65bSlpT51qiWzbyXw7stj90qcfmXw2zNtVw9nOhXjBc-x-FKSLeQM8MVc407KON5jdrub8Pf-RqO4c_7-veNXU0IbuLfckob5fhnas9CLzIvr_AtxP-9eBzk2AdsGVlCzw4P1uHOjj44JWP4x8ggowpiR7QOH0cfdnZoZeT4FqmxDkPPqJVn_NyzY4Qi-ZGdKRQJisfJczfvd0__ATX_Pj2itpPpUBlvsVdjZxhDLz6OujrrqqxSEddpUVY5FZvtNurrVh2KvM0TXeWV3latytKEu7IqE-a0yiiSmhLKkm1apEW-ybZxmrRpWeqkOKR5meUFbBIelJjLAIjE-4nrIiurIlp66ZdRQrR8-dm9PQUZ5G3xwwMR0A6IBvGeu7vby_ku30eunhPv2uno5yaJD_5KFiQYrhslZnKMweIKwNgqzx3aEeeOogwnI3qBjSZnvplhRwn91MbaDkDNUub5cXdy9iPrANQsqjxQswj7EgAA__8-w3nn">