Commit bf1cbdc6 by Richard Guenther Committed by Richard Biener

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
parent 4bb7dbf6
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.
2009-04-01 Eric Botcazou <ebotcazou@adacore.com> 2009-04-01 Eric Botcazou <ebotcazou@adacore.com>
PR rtl-optimization/39588 PR rtl-optimization/39588
......
2009-04-02 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37221
* gcc.c-torture/compile/20090331-1.c: New testcase.
2009-04-01 Eric Botcazou <ebotcazou@adacore.com> 2009-04-01 Eric Botcazou <ebotcazou@adacore.com>
* gcc.c-torture/compile/20090401-1.c: New test. * gcc.c-torture/compile/20090401-1.c: New test.
......
struct re_pattern_buffer {
unsigned char *buffer;
unsigned long int allocated;
};
void byte_regex_compile (struct re_pattern_buffer *bufp,
unsigned char *begalt, unsigned char *b)
{
unsigned char *pfrom;
unsigned char *pto;
while ((unsigned long) (b - bufp->buffer + 3) > bufp->allocated)
{
unsigned char *old_buffer = bufp->buffer;
bufp->allocated <<= 1;
if (old_buffer != bufp->buffer)
{
int incr = bufp->buffer - old_buffer;
b += incr;
}
}
pfrom = b;
pto = b + 3;
while (pfrom != begalt)
*--pto = *--pfrom;
}
...@@ -919,6 +919,7 @@ bool simplify_stmt_using_ranges (gimple_stmt_iterator *); ...@@ -919,6 +919,7 @@ bool simplify_stmt_using_ranges (gimple_stmt_iterator *);
extern void dump_dominator_optimization_stats (FILE *); extern void dump_dominator_optimization_stats (FILE *);
extern void debug_dominator_optimization_stats (void); extern void debug_dominator_optimization_stats (void);
int loop_depth_of_name (tree); int loop_depth_of_name (tree);
tree degenerate_phi_result (gimple);
/* In tree-ssa-copy.c */ /* In tree-ssa-copy.c */
extern void merge_alias_info (tree, tree); extern void merge_alias_info (tree, tree);
......
...@@ -1577,6 +1577,20 @@ analyze_initial_condition (gimple loop_phi_node) ...@@ -1577,6 +1577,20 @@ analyze_initial_condition (gimple loop_phi_node)
if (init_cond == chrec_not_analyzed_yet) if (init_cond == chrec_not_analyzed_yet)
init_cond = chrec_dont_know; 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)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
fprintf (dump_file, " (init_cond = "); fprintf (dump_file, " (init_cond = ");
......
...@@ -2475,7 +2475,7 @@ avail_expr_eq (const void *p1, const void *p2) ...@@ -2475,7 +2475,7 @@ avail_expr_eq (const void *p1, const void *p2)
/* Given PHI, return its RHS if the PHI is a degenerate, otherwise return /* Given PHI, return its RHS if the PHI is a degenerate, otherwise return
NULL. */ NULL. */
static tree tree
degenerate_phi_result (gimple phi) degenerate_phi_result (gimple phi)
{ {
tree lhs = gimple_phi_result (phi); tree lhs = gimple_phi_result (phi);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment