This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] New SRA and early interprocedural SRA
On Mon, Mar 16, 2009 at 05:46:15PM +0100, Martin Jambor wrote:
> Hi,
>
> On Thu, Mar 12, 2009 at 12:25:19AM +0100, Jan Hubicka wrote:
> > > Hi,
> > >
> > > thanks for your comments, I have addressed some of them, I am not sure
> > > what do to with another few.
> > >
> > > On Fri, Mar 06, 2009 at 12:29:07PM +0100, Jan Hubicka wrote:
> > > > Hi,
> > > > patch is OK for pretty-IPA with following changes (and changelog :)
> > >
> > > What about the current tree-sra.c and the nastiness of the passes.c
> > > hunk? Should I replace the previous intrsprocedural SRA outright?
> > > That would make it difficult for us to assess run time benefits of any
> > > subsequent patches. Should I keep it as it is? Or do something
> > > different about it?
> >
> > I would incline to simply keep it on ipa-branch. Once we will merge to
> > mainline we will be quite definitly asked about how new SRA compare to
> > old SRA so it will be easier to get data ;)
>
> I still have to test allowing unions and I have just realized I forgot
> to change compare_access_positions as you requested (I'll start a test
> straight away and commit a patch tomorrow morning) but this is what I
> have comitted to pretty-ipa branch (the patch was again approved for
> the branch on IRC).
>
As requested by Honza (and pre-approved at the same time), I have just
committed the patch below to pretty-ipa.
Testing with allowed unions in IPA-SRA went weird (interestingly, I
think the unpatched version was somehow tested incorrectly) so I will
re-test and see what happens.
Thanks,
Martin
2009-03-17 Martin Jambor <mjambor@suse.cz>
* ipa-sra.c (compare_access_positions): Use comparisons instead of
subtractions.
Index: gcc/ipa-sra.c
===================================================================
--- gcc/ipa-sra.c (revision 144899)
+++ gcc/ipa-sra.c (working copy)
@@ -1500,10 +1500,13 @@ compare_access_positions (const void *a,
const access_p f2 = *fp2;
if (f1->offset != f2->offset)
- return (int) (f1->offset - f2->offset);
- /* We want the bigger accesses first, thus the opposite order in the next
+ return f1->offset < f2->offset ? -1 : 1;
+
+ if (f1->size == f2->size)
+ return 0;
+ /* We want the bigger accesses first, thus the opposite operator in the next
line: */
- return (int) (f2->size - f1->size);
+ return f1->size > f2->size ? -1 : 1;
}