https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81192
--- Comment #11 from Tom de Vries <vries at gcc dot gnu.org> --- Created attachment 41658 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41658&action=edit 3 - Ignore EDGE_DFS_BACK in tail-merge This is a fix for the issue noted in comment 7: EDGE_DFS_BACK is in an undefined state during tail-merge, but taken into account when comparing edges, which causes missed merge opportunities in tail-merge. This patch fixes the issue by ignoring EDGE_DFS_BACK in tail-merge. For the example in this PR, the patch allows us to merge two latch blocks in the same loop. Previously this merge didn't happen because one bb had EDGE_DFS_BACK set on the back-edge, while the other one did not. A fix for trunk only, the previous two we probably want to back-port.