https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92649
--- Comment #3 from Jiangning Liu <jiangning.liu at amperecomputing dot com> --- It is a stupid test, but it is simplified from a real application. To solve even more complicated scenario, this simple case needs to be addressed first. If we change the case to be as below, int f(void) { int i, a[1024], s=0; for (i=0; i<1024; i++) a[i] = 5; for (i=0; i<37; i++) s += a[i]; return s; } the loop peeling will not work, but compiler should still know the store to elements with index >= 37 can all be eliminated. Can any framework in GCC solve this problem?