From dbbe99abdf207c014d25029d2633c7b994015a41 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Thu, 3 Feb 2011 21:50:54 +0000 Subject: [PATCH] BugFix: when we create a new Conv node in combo's exchange_leader(), this irn has no node_t. When we create a new Conv node in combo's exchange_leader(), this irn has no node_t. This is ok, replace the original node in a post walker. However, as the new node has a visited count of 0 it might be revisited again. Fix this by copying the visited count. This fixes testsuite/opt/fehler179.c [r28291] --- ir/opt/combo.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ir/opt/combo.c b/ir/opt/combo.c index 54a13d283..815822b09 100644 --- a/ir/opt/combo.c +++ b/ir/opt/combo.c @@ -3255,8 +3255,20 @@ static void exchange_leader(ir_node *irn, ir_node *leader) * the number of Conv due to CSE. */ ir_node *block = get_nodes_block(leader); dbg_info *dbg = get_irn_dbg_info(irn); - - leader = new_rd_Conv(dbg, block, leader, mode); + ir_node *nlead = new_rd_Conv(dbg, block, leader, mode); + + if (nlead != leader) { + /* Note: this newly create irn has no node info because + * it is created after the analysis. However, this node + * replaces the node irn and should not be visited again, + * so set its visited count to the count of irn. + * Otherwise we might visited this node more than once if + * irn had more than one user. + */ + set_irn_node(nlead, NULL); + set_irn_visited(nlead, get_irn_visited(irn)); + leader = nlead; + } } exchange(irn, leader); } /* exchange_leader */ -- 2.20.1