Following Sanjay's proposal from discussion in D118317, this patch
generalizes and-reduce handling to fold the following pattern
icmp ne (bitcast(icmp ne (lhs, rhs)), 0)
into
icmp ne (bitcast(lhs), bitcast(rhs))
Paths
| Differential D118431
[InstCombine] Generalize and-reduce pattern to handle `ne` case as well as `eq` ClosedPublic Authored by mkazantsev on Jan 27 2022, 9:38 PM.
Details Summary Following Sanjay's proposal from discussion in D118317, this patch icmp ne (bitcast(icmp ne (lhs, rhs)), 0) into icmp ne (bitcast(lhs), bitcast(rhs))
Diff Detail
Event TimelineComment Actions
That's a yet another pattern ((x == y) != -1 --> x != y), while here you have (x != y) != 0 --> x != y, Comment Actions LG modulo wrong proof :) This revision is now accepted and ready to land.Jan 28 2022, 12:42 AM Comment Actions I'm sure there should be more of this kind. Interestingly, analogous test for reduction-and-sext-zext-i1.ll works even w/o this change, which means we might have some other transform missing something. mkazantsev added a parent revision: D118317: [InstCombine] Fold and-reduce idiom.Jan 28 2022, 3:27 AM This revision was landed with ongoing or failed builds.Jan 30 2022, 9:14 PM Closed by commit rG70b3beb0e22d: [InstCombine] Generalize and-reduce pattern to handle `ne` case as well as `eq` (authored by mkazantsev). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 404421 llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/icmp-vec.ll
llvm/test/Transforms/InstCombine/reduction-or-sext-zext-i1.ll
|