|How to loop unswitch? email@example.com (Stephan Ceram) (2008-07-29)|
|From:||Stephan Ceram <firstname.lastname@example.org>|
|Date:||29 Jul 2008 20:52:14 GMT|
|Posted-Date:||29 Jul 2008 19:22:42 EDT|
I've a question about the compiler optimization "loop unswitching" and
its compiler heuristics.
In case of a single loop independent if/if-else statement within the
loop, there's not much choice for the conditional to be moved outside
of the loop.
But what are reasonable compiler decisions when a loop holds multiple
loop independent conditions? It might be not a good idea to unswitch
the loop separately for each condition since this would result in
multiple duplicates of the loop body possibly increasing the code size
too heavily. Thus, a compiler will very likely evaluate the conditions
with their then/else parts and begin with the most promising
condition. Any ideas how such an evaluation might work?
Does it even make sense to combine several conditions and move this
new mixed condition outside the loop?
Return to the
Search the comp.compilers archives again.