Hi, This patch enables LOOP_VECTORIZED calls processing when debug counters are used for vectorizer. Bootstrapped and regtested on x86_64-unknown-linux-gnu. Patch was approved in tracker [1] and applied to trunk.
Thanks, Ilya [1] - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68766#c3 -- gcc/ 2015-12-08 Ilya Enkovich <enkovich....@gmail.com> PR tree-optimization/68766 * tree-vectorizer.c (vectorize_loops): Check for if-converted loops when debug counters are used. gcc/testsuite/ 2015-12-08 Ilya Enkovich <enkovich....@gmail.com> PR tree-optimization/68766 * gcc.dg/pr68766.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr68766.c b/gcc/testsuite/gcc.dg/pr68766.c new file mode 100644 index 0000000..a0d549b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr68766.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize -fdbg-cnt=vect_loop:1" } */ +/* { dg-additional-options "-mavx2" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-prune-output "dbg_cnt 'vect_loop' set to 1" } */ + +int a, b, g, h; +int c[58]; +int d[58]; +int fn1() { + for (; g; g++) + if (a) + c[g] = b; +} + +int fn2() { + fn1(); + for (; h; h++) + d[h] = 0; +} diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index b721c56..c496c4b 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -536,7 +536,13 @@ vectorize_loops (void) continue; if (!dbg_cnt (vect_loop)) - break; + { + /* We may miss some if-converted loops due to + debug counter. Set any_ifcvt_loops to visit + them at finalization. */ + any_ifcvt_loops = true; + break; + } gimple *loop_vectorized_call = vect_loop_vectorized_call (loop); if (loop_vectorized_call)