This is the mail archive of the gcc-patches@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]

Re: [autovect] [patch] vectorize in cases when number of iterations may be zero


Hello,

> > I do not understand what you mean; number_of_iterations_exit never
> > called set_nb_iterations_in_loop.
> >
> 
> Sorry, I mean number_of_iterations_in_loop.

have you tried this patch with some loop for that the number of
iterations is zero (because niter_desc.may_be_zero is true)?
I do not know how you handle this case in vectorizer, but just
ignoring the niter_desc.may_be_zero condition looks a bit suspicious.

Anyway, you must call set_nb_iterations_in_loop in
number_of_iterations_in_loop (not in number_of_iterations_in_loop_1),
since the way it is done now, you will be saving the niter_desc.niter
also in the cases when may_be_zero is true (which may later cause
the results of scev analysis to be wrong).

Zdenek

 tree 
-number_of_iterations_in_loop (struct loop *loop)
+number_of_iterations_in_loop_1 (struct loop *loop, bool may_be_zero)
 {
   tree res, type;
   edge exit;
@@ -2274,7 +2278,7 @@ number_of_iterations_in_loop (struct loo
   type = TREE_TYPE (niter_desc.niter);
   if (integer_nonzerop (niter_desc.may_be_zero))
     res = build_int_cst (type, 0);
-  else if (integer_zerop (niter_desc.may_be_zero))
+  else if (may_be_zero || integer_zerop (niter_desc.may_be_zero))
     res = niter_desc.niter;
   else
     res = chrec_dont_know;
@@ -2283,6 +2287,16 @@ end:
   return set_nb_iterations_in_loop (loop, res);
 }


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