Re:Optimizing C++ Code: Dead Code Elimination
by CurtHagenlocher on Wednesday August 14, 2013 @12:11PM
(#6212329)
If you read all the way into the comments, you'll see that this does happen -- but only for values of n that are quite small. And this is a side effect of other optimizations -- not because of anything specific to this closed form.
[ Parent
| on HN ]
Re:Optimizing C++ Code: Dead Code Elimination
by DannyBee on Wednesday August 14, 2013 @12:40PM
(#6212543)
Yes, which is kinda sad.
both GCC and LLVM do it as a result of computing scalar evolutions for the variables, and then instantiating the final values after the loop.
There are certain calculations both will bail on due to solving cost (rather than inability to solve), but otherwise ...
Re:Optimizing C++ Code: Dead Code Elimination
by sharth on Wednesday August 14, 2013 @12:15PM
(#6212366)
Yeah, I was just now skimming through the comments as well and I saw that. It looks like their constant propagation logic doesn't work on loops at all, and it's just that their loop unroller stage (which runs before it) will unroll loops of less than 10 iterations.