From 57b1f16a5703630118c7813c8b96470fc84be19f Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Wed, 12 Oct 2005 14:32:29 +0000 Subject: [PATCH] optimizations for CopyB node added call DBG_ macro if block gets dead [r6692] --- ir/ir/iropt.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 5eea9a0ff..30134911b 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -749,8 +749,10 @@ static ir_node *equivalent_node_Block(ir_node *n) break; } } - if (i < 0) + if (i < 0) { n = set_Block_dead(n); + DBG_OPT_DEAD_BLOCK(oldn, n); + } } return n; @@ -1378,6 +1380,25 @@ static ir_node *equivalent_node_Confirm(ir_node *n) return get_opt_remove_Confirm() ? get_Confirm_value(n) : n; } +/** + * Optimize CopyB(mem, x, x) into a Nop + */ +static ir_node *equivalent_node_CopyB(ir_node *n) +{ + ir_node *a = get_CopyB_dst(n); + ir_node *b = get_CopyB_src(n); + + if (a == b) { + /* Turn CopyB into a tuple (mem, bad, bad) */ + ir_node *mem = get_CopyB_mem(n); + turn_into_tuple(n, pn_CopyB_max); + set_Tuple_pred(n, pn_CopyB_M, mem); + set_Tuple_pred(n, pn_CopyB_X_except, new_Bad()); /* no exception */ + set_Tuple_pred(n, pn_Call_M_except, new_Bad()); + } + return n; +} + /** * equivalent_node() returns a node equivalent to input n. It skips all nodes that * perform no actual computation, as, e.g., the Id nodes. It does not create @@ -1429,6 +1450,7 @@ static ir_op *firm_set_default_equivalent_node(ir_op *op) CASE(Mux); CASE(Cmp); CASE(Confirm); + CASE(CopyB); default: op->equivalent_node = NULL; } -- 2.20.1