Talk:Partial redundancy elimination

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computer science  
WikiProject icon This article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
 ???  This article has not yet received a rating on the project's quality scale.
 ???  This article has not yet received a rating on the project's importance scale.

Why such a strange result, doubling the code size? Won't it better look so:

 t = x + 4;
 if (some_condition) {
   // some code
   y = t;
 else {
   // other code
 z = t;
(please, sign your comments by adding 4 ~'s at the end). The point of this optimization is not to reduce code size but execution time. I.e., to prevent "x+4" from being calculated twice. (Anyway, the code size doesn't get doubled). Note that instead of "x+4" we could have a more time-consuming expression, e.g., some floating point division, or even a whole expression formed by many operators (e.g., "x*pi/180. + 3.2"). Your proposal only works in case the inner code didn't modify "x"'s value, but it would certainly be reached by a CSE optimizer should that be the case, without need of partial redundancy elimination. --euyyn 13:54, 18 June 2006 (UTC)

Imagine there is more than two paths - would we add x+4 calculation to every of paths ?

That's what is proposed. Of course, in extremis, code size can handicap execution speed, due to cache faults, but I don't think this optimization could realistically reach that point. I've not read anymore about the subject than this article, so I don't know how the authors dealed with this, nor if anyone else has. --euyyn 13:54, 18 June 2006 (UTC)