Closed
Description
Missing this fold: https://alive2.llvm.org/ce/z/5Hlb2C
define i1 @src(i8 %x, i8 %y) {
%add = add i8 %x, 1
%c1 = icmp ne i8 %x, -1
%c2 = icmp ule i8 %add, %y
%and = and i1 %c1, %c2
ret i1 %and
}
define i1 @tgt(i8 %x, i8 %y) {
%c = icmp ult i8 %x, %y
ret i1 %c
}
This can also be seen as a two-step fold with the intermediate step:
define i1 @tgt(i8 %x, i8 %y) {
%add = add i8 %x, 1
%c1 = icmp ne i8 %x, -1
%c2 = icmp ult i8 %x, %y
%and = and i1 %c1, %c2
ret i1 %and
}
Where we can replace x + 1 <= y
with x < y
because we know x != -1
from the first and condition.