https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77366
Bug ID: 77366 Summary: Rev. 2ac4967 prevents loop unrolling for s390 Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: rdapp at linux dot vnet.ibm.com CC: krebbel at gcc dot gnu.org Target Milestone: --- Host: s390 Target: s390 Since 2ac4967f49a70e1bd0bb28a142324f527dac3743 the following loop is not being unrolled anymore (-O3 -funroll-loops): void foo(unsigned int size, unsigned int *state) { unsigned int i; for(i = 0; i < size; i++) { if(*state & 1) { *state ^= 1; } } } The revision adds an additional check that allows the split-paths pass to duplicate a basic block (returned NULL before the patch) which in turn causes check_simple_exit() in loop-iv.c to not find a proper niter_desc. This seems due to if (!dominated_by_p (CDI_DOMINATORS, loop->latch, exit_bb)) failing, i.e. check_simple_exit() doesn't see that the exit condition is checked every iteration.