From 38aa26758435e599c554d542c1c41ec7c39c7900 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Sun, 1 Jun 2008 16:16:45 +0000 Subject: [PATCH] Do NOT ignore Bad Phi predecessors. Otherwise Phi nodes might be removed in dead cycles (causing normal nodes pointing to themselfs). [r19907] --- ir/ir/iropt.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index fd90fe4f9..5d040f2fb 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -1315,7 +1315,15 @@ static ir_node *equivalent_node_Phi(ir_node *n) { for (i = 0; i < n_preds; ++i) { first_val = get_Phi_pred(n, i); if ( (first_val != n) /* not self pointer */ -#if 1 +#if 0 + /* BEWARE: when the if is changed to 1, Phi's will ignore it's Bad + * predecessors. Then, Phi nodes in dead code might be removed, causing + * nodes pointing to themself (Add's for instance). + * This is really bad and causes endless recursions in several + * code pathes, so we do NOT optimize such a code. + * This is not that bad as it sounds, optimize_cf() removes bad control flow + * (and bad Phi predecessors), so live code is optimized later. + */ && (! is_Bad(first_val)) #endif ) { /* value not dead */ @@ -1334,7 +1342,8 @@ static ir_node *equivalent_node_Phi(ir_node *n) { ir_node *scnd_val = get_Phi_pred(n, i); if ( (scnd_val != n) && (scnd_val != first_val) -#if 1 +#if 0 + /* see above */ && (! is_Bad(scnd_val)) #endif ) { -- 2.20.1