This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] i386: Do not modify existing RTL (PR66412)
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Richard Biener <rguenther at suse dot de>, Jeff Law <law at redhat dot com>, Andreas dot Krebbel at de dot ibm dot com
- Date: Fri, 26 Jun 2015 03:57:03 -0500
- Subject: Re: [PATCH] i386: Do not modify existing RTL (PR66412)
- Authentication-results: sourceware.org; auth=none
- References: <CAFULd4b-55gPKo6DMhvs5arhEkVKeAk4_=TTX929YVyptq6TWw at mail dot gmail dot com>
On Fri, Jun 26, 2015 at 09:42:06AM +0200, Uros Bizjak wrote:
> Hello!
>
> > > > [ I see i386 also does PUT_CODE in a few more splitters, hrm. ]
> > >
> > > I think the splitters need to be fixed but I also think that
> > > shallow_copy_rtx should
> > > be enough, no? combine will not actually end up generating more references
> > > to the original RTX so we won't end up with invalid RTX sharing (the same logic
> > > is why the splitters didn't care).
> >
> > That probably is enough; I haven't thought about it too much, all other
> > splitters doing a copy do a deep copy. I don't think it is worth being
> > too tricky here, those splitters do not match often at all.
> >
> > > It would be cleaner to write the splitters in a way that doesnt copy the RTX
> > > but creates a new RTX with proper code/mode and operands (but that's more
> > > work on your side - maybe Uros wants to help here).
> >
> > I think people use "copy_rtx; PUT_*" because it is less typing work ;-)
> > If that is the only thing you change about the rtx, it even is easier
> > to understand than creating a new one.
>
> Attached patch implements both suggestions. It uses shallow_copy_rtx
> before all PUT_* calls in the splitters, to avoid nasty surprises like
> this one in the future. shallow_ropy_rtx copies just one level of RTX,
> and this is all what we need. Also, the patch changes existing uses of
> copy_rtx to shallow_copy_rtx.
Thanks for doing the legwork Uros! Much appreciated.
Andreas, s390 does a bit of this too (in vector.md). I cannot really
test for that at all, can you take care of it?
Segher