From: Richard Guenther Date: Thu, 10 Jan 2008 16:59:06 +0000 (+0000) Subject: re PR tree-optimization/34683 (SSA rewriting in the loop unroller causes quadratic... X-Git-Tag: releases/gcc-4.3.0~667 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0f76c4b4fa4e0248b0aeac950fd001dcfc32f4d;p=thirdparty%2Fgcc.git re PR tree-optimization/34683 (SSA rewriting in the loop unroller causes quadratic behavior) 2008-01-10 Richard Guenther PR middle-end/34683 * tree-cfg.c (tree_merge_blocks): Do not go through the full-blown folding and stmt updating path if we just deal with virtual operands. * tree-ssa-copy.c (may_propagate_copy): Do not short-cut test for abnormal SSA_NAMEs. From-SVN: r131446 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 62a4cce53584..b5a0c314fbf6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2008-01-10 Richard Guenther + + PR middle-end/34683 + * tree-cfg.c (tree_merge_blocks): Do not go through the + full-blown folding and stmt updating path if we just deal + with virtual operands. + * tree-ssa-copy.c (may_propagate_copy): Do not short-cut + test for abnormal SSA_NAMEs. + 2008-01-10 Andreas Krebbel PR middle-end/34641 diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index a8cb6276fc97..8da55ff7cd95 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -1322,7 +1322,21 @@ tree_merge_blocks (basic_block a, basic_block b) } else { - replace_uses_by (def, use); + /* If we deal with a PHI for virtual operands, we can simply + propagate these without fussing with folding or updating + the stmt. */ + if (!is_gimple_reg (def)) + { + imm_use_iterator iter; + use_operand_p use_p; + tree stmt; + + FOR_EACH_IMM_USE_STMT (stmt, iter, def) + FOR_EACH_IMM_USE_ON_STMT (use_p, iter) + SET_USE (use_p, use); + } + else + replace_uses_by (def, use); remove_phi_node (phi, NULL, true); } } diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c index ae4f50c2febe..7ae6825d3e6b 100644 --- a/gcc/tree-ssa-copy.c +++ b/gcc/tree-ssa-copy.c @@ -62,6 +62,17 @@ may_propagate_copy (tree dest, tree orig) tree type_d = TREE_TYPE (dest); tree type_o = TREE_TYPE (orig); + /* If ORIG flows in from an abnormal edge, it cannot be propagated. */ + if (TREE_CODE (orig) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig)) + return false; + + /* If DEST is an SSA_NAME that flows from an abnormal edge, then it + cannot be replaced. */ + if (TREE_CODE (dest) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (dest)) + return false; + /* For memory partitions, copies are OK as long as the memory symbol belongs to the partition. */ if (TREE_CODE (dest) == SSA_NAME @@ -164,17 +175,6 @@ may_propagate_copy (tree dest, tree orig) return false; } - /* If ORIG flows in from an abnormal edge, it cannot be propagated. */ - if (TREE_CODE (orig) == SSA_NAME - && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig)) - return false; - - /* If DEST is an SSA_NAME that flows from an abnormal edge, then it - cannot be replaced. */ - if (TREE_CODE (dest) == SSA_NAME - && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (dest)) - return false; - /* Anything else is OK. */ return true; }