summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorElias Aebi <elias.aebi@student.kit.edu>2018-04-06 10:50:05 +0200
committerJohannes Bucher <johannes.bucher2@student.kit.edu>2019-01-24 17:42:00 +0100
commit2dce64026a12f299f6d51b9f3a976260d9a08227 (patch)
treea138c8dd7cb660219c65795aaebd1d4ec6df86bd
parentf10d4d5733d204306067676ecd2c45bcf374f4c0 (diff)
duplicate all innermost loops
-rw-r--r--ir/opt/loop2.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ir/opt/loop2.c b/ir/opt/loop2.c
index e90620f..1c32dc2 100644
--- a/ir/opt/loop2.c
+++ b/ir/opt/loop2.c
@@ -283,18 +283,18 @@ static void duplicate_loop(ir_loop *const loop)
}
}
-// duplicate one innermost loop, for testing purposes
-static void duplicate_one_loop(ir_loop *const loop, bool outermost)
+static void duplicate_innermost_loops(ir_loop *const loop, bool const outermost)
{
+ bool innermost = true;
size_t const n_elements = get_loop_n_elements(loop);
for (size_t i = 0; i < n_elements; ++i) {
loop_element const element = get_loop_element(loop, i);
if (*element.kind == k_ir_loop) {
- duplicate_one_loop(element.son, false);
- return;
+ duplicate_innermost_loops(element.son, false);
+ innermost = false;
}
}
- if (!outermost)
+ if (innermost && !outermost)
duplicate_loop(loop);
}
@@ -304,7 +304,7 @@ void do_loop_unrolling2(ir_graph *const irg)
assure_lcssa(irg);
assure_irg_properties(irg, IR_GRAPH_PROPERTY_CONSISTENT_LOOPINFO | IR_GRAPH_PROPERTY_CONSISTENT_OUTS);
ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK);
- duplicate_one_loop(get_irg_loop(irg), true);
+ duplicate_innermost_loops(get_irg_loop(irg), true);
ir_free_resources(irg, IR_RESOURCE_IRN_LINK);
dump_ir_graph(irg, "loop-unrolling");
}