Refer to https://bugs.llvm.org/show_bug.cgi?id=52546. Simplifies the following cases:
- not(X) == 0 -> X != 0 -> X
- not(X) <=u 0 -> X >u 0 -> X
- not(X) >=s 0 -> X <s 0 -> X
- not(X) != 1 -> X == 1 -> X
- not(X) <=u 1 -> X >=u 1 -> X
- not(X) >s 1 -> X <=s -1 -> X
The comment and code structure suggest that we are missing related patterns.
Can we generalize this to look through a 'not' of LHS and invert/swap the predicate?
For example, we should be able to reduce these patterns too:
define i1 @not_cmp_ne(i1 %x) { %not = xor i1 %x, true %cmp = icmp ne i1 %not, true ret i1 %cmp } define i1 @not_cmp_ult(i1 %x) { %not = xor i1 %x, true %cmp = icmp ult i1 %not, 1 ret i1 %cmp }