(select (icmp sgt x, -1), lshr (X, Y), ashr (X, Y)) -> ashr (X, Y))
(select (icmp slt x, 1), ashr (X, Y), lshr (X, Y)) -> ashr (X, Y))
Fixes PR41173
Alive proof by @lebedev.ri (thanks)
Name: PR41173
%cmp = icmp slt i32 %x, 1 %shr = lshr i32 %x, %y %shr1 = ashr i32 %x, %y %retval.0 = select i1 %cmp, i32 %shr1, i32 %shr => %retval.0 = ashr i32 %x, %y
Optimization: PR41173
Done: 1
Optimization is correct!
So this returns 0 i guess?
That is confusing..