summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorElias Aebi <elias.aebi@student.kit.edu>2018-04-10 11:20:28 +0200
committerJohannes Bucher <johannes.bucher2@student.kit.edu>2019-01-24 17:42:00 +0100
commit99c80d01326d4e4fea2cf34303fefe3dad429e9f (patch)
tree2c7870e30cdc6a54a8e6cc1733c2a063646fd241
parent2dce64026a12f299f6d51b9f3a976260d9a08227 (diff)
rewire keepalives
-rw-r--r--ir/opt/loop2.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/ir/opt/loop2.c b/ir/opt/loop2.c
index 1c32dc2..b46bcb4 100644
--- a/ir/opt/loop2.c
+++ b/ir/opt/loop2.c
@@ -253,6 +253,19 @@ static void rewire_block(ir_node *const block, ir_node *const header)
}
}
+static void rewire_keepalives(ir_node *const header)
+{
+ ir_node *const end = get_irg_end(get_irn_irg(header));
+ int const arity = get_irn_arity(end);
+ for (int i = 0; i < arity; ++i) {
+ ir_node *const pred = get_irn_n(end, i);
+ ir_node *const new_pred = get_irn_link(pred);
+ if (new_pred) {
+ add_End_keepalive(end, new_pred);
+ }
+ }
+}
+
static void duplicate_loop(ir_loop *const loop)
{
ir_node *const header = get_loop_header(loop);
@@ -281,6 +294,7 @@ static void duplicate_loop(ir_loop *const loop)
rewire_block(element.node, header);
}
}
+ rewire_keepalives(header);
}
static void duplicate_innermost_loops(ir_loop *const loop, bool const outermost)