This patches teaches EarlyCSE to figure out that if and i1 %x, %y is true then both
%x and %y are true in the taken branch, and if or i1 %x, %y is false then both
%x and %y are false in non-taken branch. Fix for PR37635.
Details
Diff Detail
Event Timeline
If we want to start expanding this, i would suggest just using predicateinfo, which wouldn't require worklisting/etc to achieve this.
I'm not sure if it gives benefits, but the idea is interesting. Do you mind if it goes as a follow-up?
So, the goal would be to reduce the maintenance burden and significantly more complex logic you are starting to introduce here about what can be propagated where.
If it doesn't bring benefits, i'd like to understand why.
I'm fine doing it as a followup.
Current patch LGTM.
As a follow up, I think it might make sense to refactor the interface of the helper a bit. In particular, you have the SimpleValue::canHandle logic both in the caller and the callee. Might make sense to sink it into the callee only and check when taking items out of the worklist.
Danny, I'm not quite clear why PredicateInfo is the right direction to take here? Can you explain? Probably best done on llvm-dev instead of an individual review thread just so we have a wider audience.
It would be less confusing to name it BOp