https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117112
--- Comment #3 from rguenther at suse dot de <rguenther at suse dot de> --- On Sun, 13 Oct 2024, 652023330028 at smail dot nju.edu.cn wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117112 > > --- Comment #2 from Yi <652023330028 at smail dot nju.edu.cn> --- > (In reply to Richard Biener from comment #1) > > Thank you very much for your reply. > > > I'm not sure whether you think the bug is that the compiler doesn't see > > arr1[i] is equal to 1 and thus arr2[i] equal to 2 and k equal to 0. > > Yes, when the value of arr1 is within a certain range, the value of k is > always > equal to 0. > > In addition, when the size of the array is 16, the compiler seems to see that > k > is equal to 0. (https://godbolt.org/z/Yhxa75765) > Is there a limit to what the compiler can do when the array size is large? There's a limit on the maximum number of iterations a loop is fully peeled - we can only see the value is one when we peel. This is controlled by --param max-completely-peel-times and it's default is 16.