https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105142
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #9) > Created attachment 52745 [details] > avoid combining the conditions > > Like this prototype which fixes the testcase and avoids combining from stmts > defined in the middle BB. It could be enhanced by only considering not > combining from stmts with undefined overflow behavior (or flow-sensitive > info). > > This patch is also incomplete, maybe_fold_and_comparisons and > maybe_fold_or_comparisons is used by if-conversion, ifcombine and reassoc > and more importantly through recursion with itself and related > simplifications > in gimple-fold.cc. It's not clear where to extract the context BB from and > I didn't follow all the flow through the various routines. Esp. > if-conversion > looks susceptible, reassoc might restrict itself to conditions from the same > BB, not sure. surprisingly(?) the patch has no negative effect on the testsuite (OTOH it is incomplete and likely test coverage for vectorizer if-conversion is broader). I'm unsure whether we want to rush things for GCC 12 and to what extent we want to allow combination from the middle-block(s) (exposing, besides undefined overflow, other flow-sensitive info that depends on the outer condition being short-circuiting).