From 757e9691e224edc699466891995898e806ca4b25 Mon Sep 17 00:00:00 2001 From: Daniel Grund Date: Tue, 26 Jul 2005 09:32:09 +0000 Subject: [PATCH] Bugfix in maximum weighted independent set --- ir/be/becopyheur.c | 19 ++++++++++++++++--- ir/be/becopyopt.c | 7 ++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/ir/be/becopyheur.c b/ir/be/becopyheur.c index 0745f2c33..34e2e83de 100644 --- a/ir/be/becopyheur.c +++ b/ir/be/becopyheur.c @@ -350,8 +350,16 @@ static int qnode_try_color(const qnode_t *qn) { } else { if (qnode_is_pinned_local(qn, confl_node)) { /* changing test_node would change back a node of current ou */ - DBG((dbg, LEVEL_3, "\t Conflicting local --> add conflict\n")); - qnode_add_conflict(qn, confl_node, test_node); + if (confl_node == qn->ou->nodes[0]) { + /* Adding a conflict edge between testnode and conflnode + * would introduce a root -- arg interference. + * So remove the arg of the qn */ + DBG((dbg, LEVEL_3, "\t Conflicting local with phi --> remove from qnode\n")); + qnode_add_conflict(qn, test_node, test_node); + } else { + DBG((dbg, LEVEL_3, "\t Conflicting local --> add conflict\n")); + qnode_add_conflict(qn, confl_node, test_node); + } } if (pset_find_ptr(pinned_global, confl_node)) { /* changing test_node would change back a node of a prior ou */ @@ -384,8 +392,13 @@ static INLINE void qnode_max_ind_set(qnode_t *qn, const unit_t *ou) { while ((max = bitset_popcnt(curr)) != 0) { /* check if curr is a stable set */ int i, o, is_stable_set = 1; + + /* copy the irns */ + i = 0; bitset_foreach(curr, pos) - irns[pos] = ou->nodes[1+pos]; + irns[i++] = ou->nodes[1+pos]; + assert(i==max); + for(i=0; inodes[1+pos]; + irns[i++] = ou->nodes[1+pos]; + assert(i==max); + for(i=0; ico->chordal_env, irns[i], irns[o])) { -- 2.20.1