https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112985
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- LOGICAL_OP_NON_SHORT_CIRCUIT is applied very early and is only based on branch cost (not "compare cost"). It is IMHO premature optimization but it's been that way forever. It has similarly be adopted by the later run ifcombine pass (originally one idea was to get rid of the early short-circuiting in fold-const.cc but preserving actual behavior). Note ifcombine also doesn't care about cost but RTL expansion should when deciding whether to expand t1x > t2y | t2x < t1y as branch or not. My suggestion is to look at RTL expansion