https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101673
Bug ID: 101673 Summary: shorter unprofitable jump thread path inhibits threading of larger path Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: aldyh at gcc dot gnu.org Target Milestone: --- This is tree-ssa/ranger-threader-5.c which is now failing after the rewrite of the backwards threader with a ranger based threader (commit 2e96b5f14e4025691b57d2301d71aa6092ed44bc). I am not sure this is worth fixing, but am adding a PR so we don't loose track of the regression. Here are my notes from the test: /* This tests that we can thread BB4->BB999 coming in through the following path: latch many insns | | V V 6 -> 7 -> 3 -> 4 -> 999 The ranger based threader cannot thread this because BB4 has too many instructions so it gives up looking back. However, if we were able to looking further, we would notice that a profitable path passing through the loop latch (BB7) exists. That is, 3->4->N in isolation is not profitable, but 6->7->3->4->N is. It is not clear whether handling this case in the backwards threader is profitable, as it would increase the search space considerably. The test is being added to note a regression from the old backward threader code. This test has been distilled from libphobos/src/std/net/isemail.d. The ranger threader stops at the 3->4 subpath with: "did not thread around loop and would copy too many statements". */