According to https://alive2.llvm.org/ce/z/opsdrb, it is valid to convert (~A & B) | ~(A | B) --> ~A even if the And is a Logical And. This came up from the vector masking of predicated blocks.
Details
Diff Detail
Event Timeline
I wonder if we could replace all of the matchers in this whole function. We can't leak poison when simplifying to an existing value? This will need a pile of tests...
Also, if any logic expression folds to a constant, then a transform must be safe to match with logical and/or sub-expressions too?
LGTM - but please add a TODO comment that other (maybe all) of the similar transforms near here could be enhanced in the same way. And so we probably want to wrap the matchers or create a new matcher that works with both logical and bitwise ops.
m_c_LogicalAnd also matches m_c_And, no need for both.