http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59429
--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> --- My idea was to have sth like tree-affine for conditions and that condition optimizing passes (like ifcombine or ifcvt or phiopt) build an on-the-side representation for this, also catching straight-line code a = b < 0; c = d > 1; d = a | c; if (d) ... the tree-affine like condition can be normalized and simplified on-the-side and you'd do simplifications/lookup using that machinery, only emitting changed computes in a transform stage. Basically you collect BB or edge predicates (like ifcvt does) but with a more elaborate machinery that allows for simplification (ifcombine has its own as well). I wouldn't try to tackle this testcase from a pattern matching side. In principle comment#4 looks like sth for phiopt.