https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105338
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #5) > (In reply to Jakub Jelinek from comment #3) > > Before fwprop1, the code looks roughly the same except for the swapped > > branches, > > so in C > > if (tmp83 != 0) > > tmp82 = 5; > > else > > tmp82 = tmp83; > > vs. > > if (tmp83 == 0) > > tmp82 = tmp83; > > else > > tmp82 = 5; > > Specifically for this we could also look to canonicalize this in > uncprop which introduces the copies, making sure to rewrite this into > an equality compare? When un-propagating into a PHI in uncprop_into_successor_phis mark the BB of the PHI node. In uncprop_dom_walker::before_dom_children, when it is marked, match a diamond/half-diamond with the immediate dominator and do the rewrite of the conditional and swapping of edge flags.