-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Open
Labels
Description
| Bugzilla Link | 48148 |
| Version | trunk |
| OS | All |
| Reporter | LLVM Bugzilla Contributor |
| CC | @ecnelises,@LebedevRI,@rotateright |
Extended Description
define i64 @​foo1(i16 %0, i64 %1, i64 %2) {
entry:
%cmp1 = icmp ult i16 %0, 43
%cond1 = select i1 %cmp1, i64 %1, i64 %2
%cmp2 = icmp ugt i16 %0, 42
%cond2 = select i1 %cmp2, i64 %2, i64 %1
%ret = xor i64 %cond1, %cond2
ret i64 %ret
}
we should be able to recognize that %cond1 and %cond2 are the same, so the function should just return zero.
Comments from Sanjay Patel:
This looks like a missed canonicalization (instcombine):
https://alive2.llvm.org/ce/z/oUDr6C
We should choose one of those forms - maybe we need to refine InstCombiner::isCanonicalPredicate()? This could be tricky because we have many different kinds of cmp+select canonicalizations that we already try. We will need to make sure that we do not invert some other transform and cause an infinite-loop.