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: [patch 2/2] PR27313 Transform conditional stores


Hi,

On Thu, 12 Apr 2007, Andrew Pinski wrote:

> > 456.hmmer of SPEC2006, with the important situation looking like so:
> >
> >   int *p, *q, sc;
> >   if ((sc = q[0]) > *p) *p = sc;
> >   if ((sc = q[1]) > *p) *p = sc;
> >   if ((sc = q[2]) > *p) *p = sc;
> 
> This should be done using VN.

Currently not possible as easily.

> The generic example is:
> if (a) * c = d;
> else *c = e;

No, this has stores in both arms, hence is no conditional store.

> Which should be transformed into
> if(a) t = d; else t = e; *c = t;
> 
> Also sometimes storing when the value changes is not a good thing as
> you might invoke on the Cell, the Load Hit Store hazzard.
> 
> Putting this in PHI-OPT is the incorrect place anyways. See
> http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00494.html for the
> exactly the same issue and why you should not do this here.

That talks about not doing it in tree-ifcvt, and I've not done that.  
There are often multiple places to put an transformation, and in this case 
PHI-OPT is one of the better ones: first, it's obvious by lines of code 
to implement, second: conceptually it is a phi optimization like the 
others, namely on the PHI of the memory tag connected with the store (in 
the case that tag also is live in the join block), the optimization has 
exactly the same layout as the other PHI-OPT transformations.


Ciao,
Michael.


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