Alive2 links for "A & (~A | B) --> A & B":
https://alive2.llvm.org/ce/z/oKiodu (scalar)
https://alive2.llvm.org/ce/z/8yn8GL (vector)
Alive2 links for "A | (~A & B) --> A | B"
https://alive2.llvm.org/ce/z/v5GEKu (scalar)
https://alive2.llvm.org/ce/z/wvtJsj (vector)
This isn't doing what we wanted - the not will get commuted to operand 0.
To keep it as operand 1, we need something like this:
declare i1 @gen() define i1 @and_commute1(i1 %a) { %b = call i1 @gen() %nota = xor i1 %a, 1 %or = or i1 %b, %nota %and = select i1 %a, i1 %or, i1 0 ret i1 %and }We also need matching and tests for patterns where the "or-not" is the condition value of the select?