https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83991
Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEW CC| |amker at gcc dot gnu.org Assignee|marxin at gcc dot gnu.org |unassigned at gcc dot gnu.org --- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> --- There's diff of the problematic revision one the one before: $ diff -u pr79347.c.161t.vect ~/Programming/gcc2/objdir/gcc/pr79347.c.161t.vect --- pr79347.c.161t.vect 2018-01-25 13:57:56.262964977 +0100 +++ /home/marxin/Programming/gcc2/objdir/gcc/pr79347.c.161t.vect 2018-01-25 12:47:23.368570520 +0100 @@ -350,8 +350,8 @@ Applying pattern match.pd:90, generic-match.c:50 /home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/vect/pr79347.c:9:3: note: niters for prolog loop: (unsigned int) -((unsigned long) a.0_1 >> 1) & 7 Applying pattern match.pd:90, gimple-match.c:65 -;; Scaling loop 1 with scale 90.0% (guessed) bounding iterations to 0 from guessed 9 -;; guessed iterations are now 9 +;; Scaling loop 1 with scale 90.0% (guessed) bounding iterations to 0 from guessed 7 +;; guessed iterations are now 6 Removing basic block 11 ;; basic block 11, loop depth 0 ;; pred: 9 @@ -367,8 +367,8 @@ Applying pattern match.pd:1476, generic-match.c:571 Applying pattern match.pd:1479, generic-match.c:622 Applying pattern match.pd:1486, generic-match.c:642 -;; Scaling loop 2 with scale 87.5% (guessed) bounding iterations to 7 from guessed 10 -;; guessed iterations are now 1 +;; Scaling loop 2 with scale 87.5% (guessed) bounding iterations to 7 from guessed 7 +;; guessed iterations are now 6 /home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/vect/pr79347.c:9:3: note: === vect_update_inits_of_dr === Applying pattern match.pd:99, generic-match.c:13248 Applying pattern match.pd:99, generic-match.c:13248 Note that the second loop is not changed from guessed '10' to '7' and I think it exposes a latent bug in scale_loop_profile function. Amker may I please ask you for help? The loop looks simple, it would be easier for you to find the problem. And one another note/observation: The first loop is loop prologue where we align the pointer to 8. Isn't this situation where expected # of iterations is expected to be let's say 8/2 ? I would skip guessed loop iteration predictor for that? Thanks