aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-scalar-evolution.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-04-02 09:10:53 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-04-02 09:10:53 +0000
commitbf1cbdc6e43e3a62ef6ecac786ac70ecf5851ef6 (patch)
tree1a6f6d8f33ade81a49b8870ef8209f8ef2aa991e /gcc/tree-scalar-evolution.c
parent4bb7dbf60ef02a1172371a21e44533aa717a533a (diff)
downloadgcc-bf1cbdc6e43e3a62ef6ecac786ac70ecf5851ef6.zip
gcc-bf1cbdc6e43e3a62ef6ecac786ac70ecf5851ef6.tar.gz
gcc-bf1cbdc6e43e3a62ef6ecac786ac70ecf5851ef6.tar.bz2
re PR middle-end/37221 (Missed early loop-unroll optimization - causes 40% degradation on SPU)
2009-04-02 Richard Guenther <rguenther@suse.de> PR tree-optimization/37221 * tree-flow.h (degenerate_phi_result): Declare. * tree-ssa-dom.c (degenerate_phi_result): Export. * tree-scalar-evolution.c (analyze_initial_condition): If the initial condition is defined by a degenerate PHI node use the degenerate value. * gcc.c-torture/compile/20090331-1.c: New testcase. From-SVN: r145439
Diffstat (limited to 'gcc/tree-scalar-evolution.c')
-rw-r--r--gcc/tree-scalar-evolution.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index 8e12c2b..af959b7 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -1577,6 +1577,20 @@ analyze_initial_condition (gimple loop_phi_node)
if (init_cond == chrec_not_analyzed_yet)
init_cond = chrec_dont_know;
+ /* During early loop unrolling we do not have fully constant propagated IL.
+ Handle degenerate PHIs here to not miss important unrollings. */
+ if (TREE_CODE (init_cond) == SSA_NAME)
+ {
+ gimple def = SSA_NAME_DEF_STMT (init_cond);
+ tree res;
+ if (gimple_code (def) == GIMPLE_PHI
+ && (res = degenerate_phi_result (def)) != NULL_TREE
+ /* Only allow invariants here, otherwise we may break
+ loop-closed SSA form. */
+ && is_gimple_min_invariant (res))
+ init_cond = res;
+ }
+
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, " (init_cond = ");