Re: [PATCH] Fix the LOOP_BRANCH prediction

2012-07-31 Thread Jan Hubicka
> Thanks, Honza, > > Then shall I check in the following patch to trunk (after testing)? Yes, this is OK (with a changelog). Thanks! Honza

Re: [PATCH] Fix the LOOP_BRANCH prediction

2012-07-31 Thread Dehao Chen
Thanks, Honza, Then shall I check in the following patch to trunk (after testing)? Dehao Index: gcc/testsuite/gcc.dg/predict-7.c === --- gcc/testsuite/gcc.dg/predict-7.c(revision 0) +++ gcc/testsuite/gcc.dg/predict-7.c(revis

Re: [PATCH] Fix the LOOP_BRANCH prediction

2012-07-31 Thread Jan Hubicka
> On Tue, Jul 31, 2012 at 6:56 PM, Jan Hubicka wrote: > >> > > >> > Yeah, this may also work. The reason it is not done is that > >> > 1) it seemed expensive to force CFG changes just to compute profile > >> > decade ago > >> > 2) cfgcleanup afterwards will anyway remove the headers again. > >

Re: [PATCH] Fix the LOOP_BRANCH prediction

2012-07-31 Thread Dehao Chen
On Tue, Jul 31, 2012 at 6:56 PM, Jan Hubicka wrote: >> > >> > Yeah, this may also work. The reason it is not done is that >> > 1) it seemed expensive to force CFG changes just to compute profile >> > decade ago >> > 2) cfgcleanup afterwards will anyway remove the headers again. >> > So I o

Re: [PATCH] Fix the LOOP_BRANCH prediction

2012-07-31 Thread Jan Hubicka
> > > > Yeah, this may also work. The reason it is not done is that > > 1) it seemed expensive to force CFG changes just to compute profile decade > > ago > > 2) cfgcleanup afterwards will anyway remove the headers again. > > So I originally hoped to do the right thing without normalization

Re: [PATCH] Fix the LOOP_BRANCH prediction

2012-07-31 Thread Richard Guenther
On Tue, Jul 31, 2012 at 12:43 PM, Richard Guenther wrote: > On Tue, Jul 31, 2012 at 12:38 PM, Jan Hubicka wrote: >>> On Tue, Jul 31, 2012 at 12:20 PM, Dehao Chen wrote: >>> > Are you suggesting a patch like this: >>> > >>> > Index: gcc/predict.c >>> >

Re: [PATCH] Fix the LOOP_BRANCH prediction

2012-07-31 Thread Richard Guenther
On Tue, Jul 31, 2012 at 12:38 PM, Jan Hubicka wrote: >> On Tue, Jul 31, 2012 at 12:20 PM, Dehao Chen wrote: >> > Are you suggesting a patch like this: >> > >> > Index: gcc/predict.c >> > === >> > --- gcc/predict.c (revision 189

Re: [PATCH] Fix the LOOP_BRANCH prediction

2012-07-31 Thread Jan Hubicka
> On Tue, Jul 31, 2012 at 12:20 PM, Dehao Chen wrote: > > Are you suggesting a patch like this: > > > > Index: gcc/predict.c > > === > > --- gcc/predict.c (revision 189835) > > +++ gcc/predict.c (working copy) > > @@ -1319

Re: [PATCH] Fix the LOOP_BRANCH prediction

2012-07-31 Thread Richard Guenther
On Tue, Jul 31, 2012 at 12:20 PM, Dehao Chen wrote: > Are you suggesting a patch like this: > > Index: gcc/predict.c > === > --- gcc/predict.c (revision 189835) > +++ gcc/predict.c (working copy) > @@ -1319,6 +1319,7 @@ >

Re: [PATCH] Fix the LOOP_BRANCH prediction

2012-07-31 Thread Jan Hubicka
> Are you suggesting a patch like this: > > Index: gcc/predict.c > === > --- gcc/predict.c (revision 189835) > +++ gcc/predict.c (working copy) > @@ -1319,6 +1319,7 @@ >tree loop_bound_var = NULL; >tree loop_iv

Re: [PATCH] Fix the LOOP_BRANCH prediction

2012-07-31 Thread Dehao Chen
Are you suggesting a patch like this: Index: gcc/predict.c === --- gcc/predict.c (revision 189835) +++ gcc/predict.c (working copy) @@ -1319,6 +1319,7 @@ tree loop_bound_var = NULL; tree loop_iv_base = NULL;

Re: [PATCH] Fix the LOOP_BRANCH prediction

2012-07-31 Thread Richard Guenther
On Tue, Jul 31, 2012 at 5:17 AM, Dehao Chen wrote: > Hi, > > This patch fixed the problem when a LOOP_EXIT edge for the inner loop > happened to target at the LOOP_LATCH of the outer loop. As the outer > loop is processed first, the LOOP_BRANCH heuristic is honored > (first_match), thus the inner

[PATCH] Fix the LOOP_BRANCH prediction

2012-07-30 Thread Dehao Chen
Hi, This patch fixed the problem when a LOOP_EXIT edge for the inner loop happened to target at the LOOP_LATCH of the outer loop. As the outer loop is processed first, the LOOP_BRANCH heuristic is honored (first_match), thus the inner loop's trip count is 0. (The attached unittest demonstrates thi