From e8c648b13bff68494a19bb2a0e32a04f5f0cf40a Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Thu, 21 Feb 2008 14:27:50 +0000 Subject: [PATCH] bugfix: update_scc() must mark already seen SCC nodes, else a node might be put more than once into the SCC (causing an endless loop in the linked list ...) [r17822] --- ir/opt/opt_osr.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ir/opt/opt_osr.c b/ir/opt/opt_osr.c index 60cce6ffb..f7af05afb 100644 --- a/ir/opt/opt_osr.c +++ b/ir/opt/opt_osr.c @@ -409,6 +409,7 @@ static void update_scc(ir_node *iv, node_entry *e, iv_env *env) { ir_node *header = e->header; waitq *wq = new_waitq(); + DB((dbg, LEVEL_2, " Creating SCC for new an induction variable:\n ")); pscc->head = NULL; waitq_put(wq, iv); do { @@ -419,16 +420,21 @@ static void update_scc(ir_node *iv, node_entry *e, iv_env *env) { ne->pscc = pscc; ne->next = pscc->head; pscc->head = irn; + DB((dbg, LEVEL_2, " %+F,", irn)); for (i = get_irn_arity(irn) - 1; i >= 0; --i) { ir_node *pred = get_irn_n(irn, i); node_entry *pe = get_irn_ne(pred, env); - if (pe->header == header && pe->pscc == NULL) + if (pe->header == header && pe->pscc == NULL) { + /* set the psc here to ensure that the node is NOT enqueued another time */ + pe->pscc = pscc; waitq_put(wq, pred); + } } } while (! waitq_empty(wq)); del_waitq(wq); + DB((dbg, LEVEL_2, "\n")); } /** -- 2.20.1