How to loop unswitch?

This is a discussion on How to loop unswitch? within the Compilers forums in Theory and Concepts category; Hi, 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 ...

Go Back   Application Development Forum > Theory and Concepts > Compilers

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 07-29-2008, 04:52 PM
Stephan Ceram
Guest
 
Default How to loop unswitch?

Hi,

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?

Regards,
Stephan

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 06:37 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.