summaryrefslogtreecommitdiffhomepage
path: root/ir/opt
diff options
context:
space:
mode:
authorElias Aebi <elias.aebi@student.kit.edu>2018-02-22 10:58:40 +0100
committerJohannes Bucher <johannes.bucher2@student.kit.edu>2019-01-24 17:42:00 +0100
commita5c1f590ecf0a960461a638b5842091e9b1346dc (patch)
tree3a1fb257616d5d6f550ec12ea4a0b4849a039e46 /ir/opt
parentb7079aeef61af00d9e29c8721fc48e9c8ea719ec (diff)
fix a segfault
Diffstat (limited to 'ir/opt')
-rw-r--r--ir/opt/loop2.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ir/opt/loop2.c b/ir/opt/loop2.c
index 0bbb8ca..ebabcbd 100644
--- a/ir/opt/loop2.c
+++ b/ir/opt/loop2.c
@@ -17,6 +17,7 @@ static void duplicate_node(ir_node *const node, ir_node *const new_block)
static void rewire_node(ir_node *const node)
{
ir_node *const new_node = get_irn_link(node);
+ assert(new_node);
assert(get_irn_arity(node) == get_irn_arity(new_node));
// TODO: use foreach_irn_in
int const arity = get_irn_arity(new_node);
@@ -35,8 +36,9 @@ static void rewire_node(ir_node *const node)
static void duplicate_block(ir_node *const block)
{
- ir_node *const new_block = exact_copy(block);
- unsigned int const n_outs = get_irn_n_outs(block);
+ ir_node *const new_block = exact_copy(block);
+ set_irn_link(block, new_block);
+ unsigned int const n_outs = get_irn_n_outs(block);
for (unsigned int i = 0; i < n_outs; ++i) {
ir_node *const node = get_irn_out(block, i);
assert(!is_Block(node));