To generate simplified IR, make sure fold
(X & ~C) ==/!= 0 --> X u</u>= C+1
is scheduled before fold
((X << Y) & C) == 0 -> (X & (C >> Y)) == 0.
Differential D63505
[InstCombine] Fold icmp eq/ne (and %x, C), 0 iff (-C) is power of two -> %x u</u>= (-C) earlier. huihuiz on Jun 18 2019, 11:19 AM. Authored by
Details To generate simplified IR, make sure fold (X & ~C) ==/!= 0 --> X u</u>= C+1 is scheduled before fold ((X << Y) & C) == 0 -> (X & (C >> Y)) == 0.
Diff Detail
Event TimelineComment Actions Looks good for IR, but looks like this needs an undo fold for backend?
Comment Actions Yes , this reorder expose yet another missing fold. As regression in test/Transforms/InstCombine/pr17827.ll Simplify 'shl' inequality test into 'and' equality test should fix this issue. I am posting this into another differential, link shortly. icmp ult/uge (shl %x, C2), C1 iff C1 is power of two -> icmp eq/ne (and %x, (lshr -C1, C2)), 0
|
Why are we restricting this fold to single-use and?