I mis-spelled the "org" as "og" and thus the email got bounced. So, here it is again.
Thanks, Balaji V. Iyer. > -----Original Message----- > From: Iyer, Balaji V > Sent: Thursday, March 20, 2014 4:34 PM > To: 'Jakub Jelinek' > Cc: gcc-patc...@gcc.gnu.og > Subject: RE: [PING] [PATCH] _Cilk_for for C and C++ > > > > > -----Original Message----- > > From: Jakub Jelinek [mailto:ja...@redhat.com] > > Sent: Thursday, March 6, 2014 6:55 AM > > To: Iyer, Balaji V > > Cc: gcc-patc...@gcc.gnu.og > > Subject: Re: [PING] [PATCH] _Cilk_for for C and C++ > > > > On Tue, Mar 04, 2014 at 03:35:32PM +0000, Iyer, Balaji V wrote: > > > Did you get a chance to look at this? > > > > Please look what you are emitting for cf3.cc, e.g. in *.gimple: > > > > D.2883 = J<int>::begin (j); > > I<int>::I (&i, D.2883); > > D.2885 = J<int>::end (j); > > retval.0 = operator-<int> (D.2885, &i); > > D.2886 = retval.0 /[cl] 2; > > #pragma omp parallel firstprivate(i) if(D.2886) shared(D.2865) > > lastprivate(D.2864) > > { > > const difference_type D.2866; > > long int D.2887; > > struct I & D.2888; > > > > try > > { > > > > _Cilk_for (D.2864 = 0; D.2864 < 0; D.2864 = D.2864 + > > 2) linear(D.2864:2) schedule(cilk-for grain,0) > > > > That is just plain wrong, you aren't iterating zero times, but > > D.2886 times, so there should be D.2864 < retval.0. > > In *.original that is: > > <<cleanup_point <<< Unknown tree: expr_stmt > > (void) (i = TARGET_EXPR <D.2854, <<< Unknown tree: aggr_init_expr > > 5 > > __comp_ctor > > D.2854 > > 0B > > (const struct I &) (const struct I *) J<int>::begin ((struct J *) j) >>>>) > >>>>>; > > #pragma omp parallel firstprivate(i) schedule(cilk-for grain,0) > > if(<<cleanup_point operator-<int> ((const struct I &) (const struct I > > *) J<int>::end ((struct J *) j), (const struct I &) (const struct I *) > > &i)>> /[cl] 2) > > { > > { > > try <======================== HERE > ======================== > > { > > difference_type D.2864; > > difference_type D.2865; > > > > { > > <<cleanup_point <<< Unknown tree: expr_stmt (void) > > (D.2865 = 0) > > >>>>> > > _Cilk_for (D.2864 = 0; D.2864 < 0; D.2864 = D.2864 + > > 2) schedule(cilk- for grain,0) if(<<cleanup_point operator-<int> > > ((const struct I &) (const struct I *) J<int>::end ((struct J *) j), > > (const struct I &) (const struct I *) &i)>> /[cl] 2) > > > > As I've said several times before, don't put the operator- expression > > into if clause, instead evaluate it into a scalar temporary first > > (get_temp_regvar), before the #pragma omp parallel, and use the result > > of get_temp_regvar in the if clause (temp /[cl] 2) and in firstprivate > > clause on omp parallel and as the high bound of _Cilk_for. > > Hi Jakub, > First off, I am sorry for the delay in response. I had a couple family > issues to deal with that tied me up for the past week. > Yes, I agree that it looks weird in the intermediate code. I tried to > move the operator-(...) value into a variable (in the function > handle_omp_for_class_iterator) and it was giving me an ICE during gimplify > case. The issue was scoping. The if clause is sitting on #pragma omp parallel, > but when I move the operator- to a variable it is inside the try block (marked > by <==== HERE =====). Also, this only happens when we deal with iterators > and overloaded opeators. All the other cases the intermediate code looks > OK. This only happens in dump of gimple and original. All the intermediate > codes after that (>= .012) looks OK. Since this is a specific case, can you > accept this as a workaround for now? > > Thanks, > > Balaji V. Iyer.