diff options
author | Luca Barbieri <[email protected]> | 2010-09-07 17:03:43 +0200 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2010-09-13 16:20:40 -0700 |
commit | 2cdbced10d98214616bcc5f960b21185c433d23b (patch) | |
tree | 0720ef1aeb31047bd7a9fdeffc9eabf892dad5a7 /common.py | |
parent | 8f2214f4892acb994d13531d555196bd8f242dad (diff) |
loop_unroll: unroll loops with (lowered) breaks
If the loop ends with an if with one break or in a single break unroll
it. Loops that end with a continue will have that continue removed by
the redundant jump optimizer. Likewise loops that end with an
if-statement with a break at the end of both branches will have the
break pulled out after the if-statement.
Loops of the form
for (...) {
do_something1();
if (cond) {
do_something2();
break;
} else {
do_something3();
}
}
will be unrolled as
do_something1();
if (cond) {
do_something2();
} else {
do_something3();
do_something1();
if (cond) {
do_something2();
} else {
do_something3();
/* Repeat inserting iterations here.*/
}
}
ir_lower_jumps can guarantee that all loops are put in this form
and thus all loops are now potentially unrollable if an upper bound
on the number of iterations can be found.
Signed-off-by: Ian Romanick <[email protected]>
Diffstat (limited to 'common.py')
0 files changed, 0 insertions, 0 deletions