This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/77848] Gimple if-conversion results in redundant comparisons


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

--- Comment #11 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
(In reply to rguenther@suse.de from comment #10)
> On Fri, 4 Nov 2016, wschmidt at gcc dot gnu.org wrote:
> 
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77848
> > 
> > --- Comment #8 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
> > FYI, the patch I am testing is:
> > 
> > Index: gcc/tree-if-conv.c
> > ===================================================================
> > --- gcc/tree-if-conv.c  (revision 241802)
> > +++ gcc/tree-if-conv.c  (working copy)
> > @@ -2767,8 +2767,7 @@ tree_if_conversion (struct loop *loop)
> >           || loop->dont_vectorize))
> >      goto cleanup;
> > 
> > -  if ((any_pred_load_store || any_complicated_phi)
> > -      && !version_loop_for_if_conversion (loop))
> > +  if (flag_tree_loop_vectorize && !version_loop_for_if_conversion (loop))
> >      goto cleanup;
> 
> can any_pred_load_store or any_complicated_phi never be true without
> flag_tree_loop_vectorize?

It's quite possible, I'm not sure.  I was trying to remove all preconditions
for doing if-conversion, but without the test for flag_tree_loop_vectorize I
ran into failures in the test suite for -O2 -ftree-if-conversion or whatever it
is.

> 
> Btw, I think we should simply guard if-conversion with
> flag_tree_loop_vectorize... (given it has no cost model)

Seems that can work if we can make SLP vectorization handle the
PHI-convertibles on its own without if-conversion, as you suggested, but until
then it will lose some SLP opportunities.

By the way, outer loop vectorization is failing because of

      if ((loop->inner)->inner || (loop->inner)->next)
        {
          if (dump_enabled_p ())
            dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
                             "not vectorized: multiple nested loops.\n");
          return false;
        }

The versioned inner loop has two loops, so we don't even consider it further.

Bill

> 
> Richard.
> 
> >    /* Now all statements are if-convertible.  Combine all the basic
> > 
> >

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]