https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113734

--- Comment #19 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Ok, removing all the noise shows that this is the same issue as I saw before.

The code out of the vectorizer is correct, but cunroll does a dodgee unrolling.

-fdisable-tree-cunroll confirms it's the unrolling.

cunroll claims:

Loop 4 iterates at most 16 times.                                              
                                                                               
                                                                               
                             Loop 4 likely iterates at most 16 times.          
                                                                               
                                                                               
                                                          Analyzing # of
iterations of loop 4                                                           
                                                                               
                                                                               
                exit condition [1, + , 1](no_overflow) < bnd.157_285 
...
;; Guessed iterations of loop 4 is 7.347979. New upper bound 16.               
                                                                               
                                                                               
                             Making edge 23->36 impossible by redistributing
probability to other edges. Original probability: 93.8% (guessed)              
                                                                               
                                                             misc.c:147:31:
optimized: loop with 16 iterations completely unrolled (header execution count
2859449)                                                                       
                                                                               
               Last iteration exit edge was proved true.                       
                                                                               
                                                                               
                                            Not peeling: number of iterations
is not estimated 

but the i is bounded by i < 306. and VF=8. so binding loop iteration to 16
means it just cut off half the loop.

so it looks like the upper bounds is wrong. Checking what we write out during
loop vect.

Reply via email to