https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113380
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Richard Biener from comment #1) > Interesting - smells like fold-const.cc stuff not in match.pd. It is not, In the `||` case, the ethread (ranger) is able to opimize away the second part to either 0 or 1 due to having basic blocks. While in the `|` case there is no basic block for ranger to anchor to. I am not 100% sure how to solve this but an idea is if you have a `bool | bool`, always create during gimplification `if (a) goto c; else if (b) goto c; else goto d; ` Likewise for `bool & bool`.