This is the mail archive of the gcc@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: improving auto increment expressions detection across basic blocks.


The auto-increment code was a quick hack based on the code that
existed in flow.c.  I moved it to a new pass and generalized it quite
a bit, but it is at its core, basicly the same local code.

The right way to implement this is as a global, or at least loop by
loop problem where du or ud chains guide the process.

Unfortunately, du and ud chains are expensive, and we need to and plan
to move to fuds in the near future.  then it will be reasonable to
consider upgrading many of the local optimizations to have a larger
context.  

I will point out one caveat with doing an extensive upgrading of this
code.   We fixed a LOT of bugs when i added this pass: well beyond the
number of bugs that just came with the pass itself.   

The majority of the new bugs were places where the rest of the
compiler was just not expecting to see auto inc or dec instructions. 
If you want to take on doing this kind of extension, be prepared for
the additional cost.  


> Hi Andrew,
> 
> On Mon, Apr 7, 2008 at 4:41 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> > On Mon, Apr 7, 2008 at 3:31 AM, Ramana Radhakrishnan <ramana.r@gmail.com> wrote:
> >  >  The basic case is as explained below.
> >  >
> >  >  for (i = 0; i < 100; i ++)
> >  >  {
> >  >   if (....)
> >  >  {
> >  >   a[i] = something;
> >  >  }
> >  >  else
> >  >   a[i] = something else..
> >  >
> >  >  }
> >
> >  If it is this case, I think the store to a[i] should really sinked
> >  below the if statement instead of doing anything fancy with
> >  autoincrement.
> 
> In this case I agree that sinking the store would take care of the
> auto increment because you'd then have the store and the increment in
> the same block and hence things should theoretically work. Ofcourse
> the a[i] in both edges of the if need not exist and the else could
> instead be an update to a b[i] in which case there might be a need for
> something fancy with auto-increments.
> 
> Cheers
> Ramana
> 
> 
> >
> >  Thanks,
> >  Andrew Pinski
> >
> -- 
> Ramana Radhakrishnan
> 


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