This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/67681] Missed vectorization: induction variable used after loop
- From: "alalaw01 at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 09 Mar 2016 17:47:31 +0000
- Subject: [Bug tree-optimization/67681] Missed vectorization: induction variable used after loop
- Auto-submitted: auto-generated
- References: <bug-67681-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67681
--- Comment #5 from alalaw01 at gcc dot gnu.org ---
In the -DFOO=0 case, we have peeled an extra copy of the inner loop condition,
i <= max_7, above the loop. scalar evolution (final_value_replacement_loop)
works, because it sees the inner loop goes round niter = (unsigned int) max_7 -
(unsigned int) i_25 iterations, and compute_overall_effect_of_inner_loop gives
us
(int) (((unsigned int) i_25 + ((unsigned int) max_7 - (unsigned int) i_25)) +
1)
which is not expression_expensive_p, so we do it. Hence the add/subtract above.
When -DFOO=1, we have not done that peeling, so niter = i_22 <= max_24 ?
(unsigned int) max_24 - (unsigned int) i_22 : 0, and
compute_overall_effect_of_inner_loop gives us
(i_22 + 1) + (i_22 <= max_24 ? (int) ((unsigned int) max_24 - (unsigned int)
i_22) : 0)
which is expression_expensive_p, so we don't do the final value replacement.