From 745a5c9a4ac74897a9cd92d9519d9a3f10fbe132 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Sun, 25 May 2008 02:14:38 +0000 Subject: [PATCH] - do not optimize away Confirms with Constants [r19753] --- ir/ir/iropt.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index a3bbb507f..27cafe86f 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -637,8 +637,16 @@ static tarval *computed_value_Psi(ir_node *n) { * if it has the form Confirm(x, '=', Const). */ static tarval *computed_value_Confirm(ir_node *n) { - return get_Confirm_cmp(n) == pn_Cmp_Eq ? - value_of(get_Confirm_bound(n)) : tarval_bad; + /* + * Beware: we might produce Phi(Confirm(x == true), Confirm(x == false)). + * Do NOT optimize them away (CondEval wants them), so wait until + * remove_confirm is activated. + */ + if (get_opt_remove_confirm()) { + return get_Confirm_cmp(n) == pn_Cmp_Eq ? + value_of(get_Confirm_bound(n)) : tarval_bad; + } + return tarval_bad; } /* computed_value_Confirm */ /** @@ -1592,19 +1600,9 @@ static ir_node *equivalent_node_Confirm(ir_node *n) { */ n = pred; } - if (pnc == pn_Cmp_Eq) { - ir_node *bound = get_Confirm_bound(n); - - /* - * Optimize a rare case: - * Confirm(x, '=', Constlike) ==> Constlike - */ - if (is_irn_constlike(bound)) { - DBG_OPT_CONFIRM(n, bound); - return bound; - } - } - return get_opt_remove_confirm() ? get_Confirm_value(n) : n; + if (get_opt_remove_confirm()) + return get_Confirm_value(n); + return n; } /** -- 2.20.1