summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorElias Aebi <elias.aebi@student.kit.edu>2018-04-24 10:43:54 +0200
committerJohannes Bucher <johannes.bucher2@student.kit.edu>2019-01-24 17:42:00 +0100
commita916512dc84d4e9ff79ececdb480812766366abb (patch)
tree91bbd59a611299a254e4aaec046377e87d2d1aea
parent5621a9e3050a712d35ced9281ef8435fbea8ee49 (diff)
simplify
-rw-r--r--ir/opt/lcssa.c4
-rw-r--r--ir/opt/loop2.c11
2 files changed, 7 insertions, 8 deletions
diff --git a/ir/opt/lcssa.c b/ir/opt/lcssa.c
index 61f4547..9878dfd 100644
--- a/ir/opt/lcssa.c
+++ b/ir/opt/lcssa.c
@@ -58,9 +58,9 @@ static ir_node *insert_phis_recursive(ir_node *const pred, ir_node *const block)
for (int i = 0; i < arity; ++i) {
ir_node *const pred_block = get_Block_cfgpred_block(block, i);
- in[i] = insert_phis_recursive(pred, pred_block);
+ ir_node *const pred_phi = insert_phis_recursive(pred, pred_block);
+ set_irn_n(phi, i, pred_phi);
}
- set_irn_in(phi, arity, in);
return phi;
}
diff --git a/ir/opt/loop2.c b/ir/opt/loop2.c
index 5ed0a61..e52f3ba 100644
--- a/ir/opt/loop2.c
+++ b/ir/opt/loop2.c
@@ -66,13 +66,15 @@ static ir_node *get_loop_header(ir_loop *const loop)
return block_dominates_loop(header, loop) ? header : NULL;
}
-static void duplicate_node(ir_node *const node, ir_node *const new_block)
+static ir_node *duplicate_node(ir_node *const node, ir_node *const new_block)
{
ir_node *const new_node = exact_copy(node);
- set_nodes_block(new_node, new_block);
+ if (!is_Block(new_node))
+ set_nodes_block(new_node, new_block);
set_irn_link(node, new_node);
set_irn_link(new_node, node);
DB((dbg, LEVEL_3, "duplicating node %N (%n), new node %N\n", node, node, new_node));
+ return new_node;
}
static void rewire_successor_phi(ir_node *const phi, ir_node *const block, int arity, int new_arity)
@@ -212,10 +214,7 @@ static void rewire_node(ir_node *const node, ir_node *const header)
static void duplicate_block(ir_node *const block)
{
- ir_node *const new_block = exact_copy(block);
- set_irn_link(block, new_block);
- set_irn_link(new_block, block);
- DB((dbg, LEVEL_3, "duplicating block %N, new block %N\n", block, new_block));
+ ir_node *const new_block = duplicate_node(block, NULL);
unsigned int const n_outs = get_irn_n_outs(block);
for (unsigned int i = 0; i < n_outs; ++i) {