Re: nuances of Copy Propagation?

joris@eunet.be (Joris Welkenhuysen)
Sun, 6 Nov 1994 19:54:55 GMT

          From comp.compilers

Related articles
nuances of Copy Propagation? johnmce@world.std.com (1994-11-03)
Re: nuances of Copy Propagation? c1venkat@watson.ibm.com (K.S. Venkatesh) (1994-11-09)
Re: nuances of Copy Propagation? wjs@VNET.IBM.COM (William Schmidt) (1994-11-09)
Re: nuances of Copy Propagation? joris@eunet.be (1994-11-06)
Re: nuances of Copy Propagation? davidm@Rational.COM (1994-11-08)
Re: nuances of Copy Propagation? bill@amber.ssd.csd.harris.com (1994-11-14)
| List of all articles for this month |
Newsgroups: comp.compilers
From: joris@eunet.be (Joris Welkenhuysen)
Keywords: optimize, comment
Organization: EUnet Belgium
References: 94-11-028
Date: Sun, 6 Nov 1994 19:54:55 GMT

John McEnerney (johnmce@world.std.com) wrote:
: I'm implementing the Copy Propagation optimization as described in the
: new Dragon Book, pp. 636-638, and I've run into an interesting problem
: motivated by the following case:


: y=x; z=y; x=3; w=z+100;


: The dataflow computation tells me that I can propagate 'x' to 'z=y', and
: that I can propagate 'y' to 'w=z+100', but obviously I can't eliminate
: both 'y=x' and 'z=y' because of the assignment to x. So I can choose one
: or the other:


: z=x; x=3; w=z+100; -OR- y=x; x=3; w=y+100;


Your problem is that you try to propagate variables and not the values they
contain. So if you write your original source code as follows :




   y_0=x_0; z_0=y_0; x_1=3; w_0=z_0+100;


where the `_n' notation is meant to differentiate among the values
each of the variables contains, then everything works out fine :


                y_0 = x_0 = z_0
                x_1 = 3
                w_0 = x_0 + 100


BTW : what is the new Dragon book ? I see references to this book in this
newsgroup once in a while and I suppose the book is named like that because
of some cover drawing, but I suppose it also has an offical title, no ?


Joris.
[The new dragon book is the 1986 edition of Aho, Sethi, and Ullman. See the
FAQ. There's a dragon on the cover. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.