select Cond, T, false --> Cond & T
select Cond, true, F --> Cond | F
This fixes regressions that would be visible if we remove known poison-unsafe transforms in instcombine mentioned here:
https://reviews.llvm.org/D72396#1810460
I'm not sure yet how to deal with the 'and-not' and 'or-not' variations.
Alive2 example for 1 of the tests:
http://volta.cs.utah.edu:8080/z/Ue2UE3
I would recommend making this more obvious:
// select Cond, T, false --> Cond & T if (match(F, m_ZeroInt())) if(Value* V = SimplifyAndInst(Cond, T, Q)) return V; // select Cond, true, F --> Cond | F if (match(T, m_One())) if(Value* V = SimplifyOrInst(Cond, F, Q)) return V;