https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106754
Bug ID: 106754 Summary: compute_control_dep_chain over-estimates domain Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- The following testcase shows compute_control_dep_chain for init_use_preds of the 'return u' uninitialized use compute a path with w != 0 && v != 1, leaving out the !(i < 10) loop exit predicate because of how the iteration terminating condition on the post-dominator walk works. While there's a special case for the loop exit edge itself, the following if (y) z = 1; intermediate post-dominator will still make the iteration terminate early before reaching if (v != 1) and eventually the target block. The parent iteration which entered the loop will proceed to find that but the loop exit condition will be lost. extern unsigned bar (void); extern void quux (void); int z; unsigned foo (unsigned v, int y, int w) { unsigned u; if (v != 1) u = bar (); // This variantion from uninit-pred-11.c causes compute_control_dep_chain // to run into a defect, producing z != 0 && v != 1, omitting !(i<10) // from the path predicate if (w) { for (int i = 0; i < 10; i++) quux (); if (y) z = 1; if (v != 1) return u; } return 0; }