Re: Constructive criticism
- Posted by mattlewis (admin) Mar 09, 2009
- 1043 views
Anyway, call a procedure in between and the optimization becomes invalid, because the procedure may modify "stacks[stack]".
Correct. A potential optimization might be to follow the procedure through to make sure that it doesn't modify stacks[stack], but I think we're both headed toward the same conclusion: once you've done all the optimizations possible, you hit a situation that you can't optimize away and you need to be able to specifiy whether you intended to make a true independent copy or just a reference.
The inlining code currently does this to see if it needs to assign to a temp to make sure the value isn't modified. A planned optimization to this is to detect when the passed parameter is assigned the result of the function, to make it behave the same as PBR.
Matt