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: [tree-ssa] copy-propagation pass



On Mon, 25 Nov 2002, Jason Merrill wrote:

> On Mon, 25 Nov 2002 10:25:13 -0800, Aldy Hernandez <aldyh@redhat.com> wrote:
>
> > In talking with Diego, we have found one big problem, which is:
> >
> >    a = y;
> >    y = z;
> >    if (a)
> >       blah;
>
> Seems like SSA should handle this.
>
It does, technically.
It's just that since var's are canonical, and we don't do actual renaming,
you have no way to say *which* y you want.

Renaming involves adding temporaries (since you are splitting the
single variable name into multiple variable names).
It's just not done *for you* in fud chaining.

Aldy can simply add the temporaries necessary to propagate if he likes (ie
transform it to:

temp = y;
a = y;
y = z;
if (temp)

DCE will then remove whatever isn't actually used anymore (IE if nothing
else uses the value of a).
Just be careful not to re-propagate the temps you add.
:)

> a = y1
> y2 = z;
> if (a)   --> if (y1)
>   blah;
>
> Your problem comes from treating the two y's as one.
>

Yes.
It's one of the few optimizations that is a bit trickier without renaming.

> Jason
>


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