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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
So the change enables early exit vectorization since may_be_zero is _10 == 0
here, resulting in an overall

number_of_iterationsm1 == _10 != 0 ? _10 + 4294967295 : 0

and

number_of_iterations = MAX_EXPR <_10, 1>

We're vectorizing the induction to re-start the iteration after exit which
I think is all OK (but it must be broken...).  But we're stuck in a
not vectorized loop,

94        /* Skip bits that are zero.  */
95        for (; (i->word & 1) == 0; i->word >>= 1)
96          i->bit_num++;

   0x0000000000400890 <+528>:   shr    %rdx
   0x0000000000400893 <+531>:   mov    %ecx,%eax
   0x0000000000400895 <+533>:   inc    %ecx
=> 0x0000000000400897 <+535>:   test   $0x1,%dl
   0x000000000040089a <+538>:   je     0x400890 <sbitmap_first_set_bit+528>

and %rdx is zero.

I think the vector IL is sound.

Disabling cunroll allows the testcase to pass, so it might be an error on
the upper bound of its iterations (but I think that's OK, too).

What looks a bit odd is the condition for skipping the epilogue which
we should never do for LOOP_VINFO_EARLY_BREAKS_VECT_PEELED, we're using

      /* If we have a peeled vector iteration we will never skip the epilog
loop
         and we can simplify the cfg a lot by not doing the edge split.  */
      if (skip_epilog || LOOP_VINFO_EARLY_BREAKS (loop_vinfo))
        {
          guard_cond = fold_build2 (EQ_EXPR, boolean_type_node,
                                    niters, niters_vector_mult_vf);

here, but I think niters_vector_mult_vf is wrong (but it doesn't matter
here, still it looks bogus).

Reply via email to