https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102075
Bug ID: 102075 Summary: fill_always_executed_in_1 incomplete computation Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: luoxhu at gcc dot gnu.org Target Milestone: --- ALWAYS_EXECUTED_IN is not computed completely for nested loops. Current design will exit if an inner loop doesn't dominate outer loop's latch or exit after exiting from inner loop, which caused early return from outer loop, then ALWAYS EXECUTED blocks after inner loops are skipped. For example, x->k should be move out of outer loop but doesn't. struct X { int i; int j; int k;}; void foo(struct X *x, int n, int l) { for (int j = 0; j < l; j++) { for (int i = 0; i < n; ++i) { int *p = &x->j; int tem = *p; x->j += tem * i; } int *r = &x->k; int tem2 = *r; x->k += tem2 * j; } } Discussion lists: https://gcc.gnu.org/pipermail/gcc-patches/2021-August/577444.html