Commit 92a5094e by Richard Biener Committed by Richard Biener

re PR tree-optimization/64193 (Decreased performance after r173250)

2014-12-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/64193
	* tree-ssa-alias.c (walk_non_aliased_vuses): Add valueize parameter
	and valueize the VUSE before looking up the def stmt.
	* tree-ssa-alias.h (walk_non_aliased_vuses): Adjust prototype.
	* tree-ssa-sccvn.c (vn_reference_lookup_pieces): Pass vn_valueize
	to walk_non_aliased_vuses.
	(vn_reference_lookup): Likewise.
	* tree-ssa-dom.c (lookup_avail_expr): Pass NULL as valueize
	callback to walk_non_aliased_vuses.

	* gcc.dg/tree-ssa/ssa-fre-43.c: New testcase.

From-SVN: r218515
parent c3e1e693
2014-12-09 Richard Biener <rguenther@suse.de> 2014-12-09 Richard Biener <rguenther@suse.de>
PR tree-optimization/64193
* tree-ssa-alias.c (walk_non_aliased_vuses): Add valueize parameter
and valueize the VUSE before looking up the def stmt.
* tree-ssa-alias.h (walk_non_aliased_vuses): Adjust prototype.
* tree-ssa-sccvn.c (vn_reference_lookup_pieces): Pass vn_valueize
to walk_non_aliased_vuses.
(vn_reference_lookup): Likewise.
* tree-ssa-dom.c (lookup_avail_expr): Pass NULL as valueize
callback to walk_non_aliased_vuses.
2014-12-09 Richard Biener <rguenther@suse.de>
PR middle-end/64199 PR middle-end/64199
* fold-const.c (fold_binary_loc): Use TREE_OVERFLOW_P. * fold-const.c (fold_binary_loc): Use TREE_OVERFLOW_P.
2014-12-09 Richard Biener <rguenther@suse.de> 2014-12-09 Richard Biener <rguenther@suse.de>
PR tree-optimization/64193
* gcc.dg/tree-ssa/ssa-fre-43.c: New testcase.
2014-12-09 Richard Biener <rguenther@suse.de>
PR middle-end/64199 PR middle-end/64199
* gcc.dg/torture/pr64199.c: New testcase. * gcc.dg/torture/pr64199.c: New testcase.
......
/* PR tree-optimization/64193 */
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-fre1-details" } */
double T,T2,E1[5];
int J;
void
PA(double E[])
{
J = 0;
L10:
E[1] = ( E[1] + E[2] + E[3] - E[4]) * T;
E[2] = ( E[1] + E[2] - E[3] + E[4]) * T;
E[3] = ( E[1] - E[2] + E[3] + E[4]) * T;
E[4] = (-E[1] + E[2] + E[3] + E[4]) / T2;
J += 1;
if (J < 6)
goto L10;
}
/* We should remove 15 dead loads, fully propagating their replacements
with exactly 4 loads and 4 stores from/to E remaining. */
/* { dg-final { scan-tree-dump-times "Removing dead stmt" 15 "fre1" } } */
/* { dg-final { scan-tree-dump-not "Not changing value number" "fre1" } } */
/* { dg-final { cleanup-tree-dump "fre1" } } */
...@@ -2632,12 +2632,18 @@ get_continuation_for_phi (gimple phi, ao_ref *ref, ...@@ -2632,12 +2632,18 @@ get_continuation_for_phi (gimple phi, ao_ref *ref,
If TRANSLATE returns NULL the walk continues and TRANSLATE is supposed If TRANSLATE returns NULL the walk continues and TRANSLATE is supposed
to adjust REF and *DATA to make that valid. to adjust REF and *DATA to make that valid.
VALUEIZE if non-NULL is called with the next VUSE that is considered
and return value is substituted for that. This can be used to
implement optimistic value-numbering for example. Note that the
VUSE argument is assumed to be valueized already.
TODO: Cache the vector of equivalent vuses per ref, vuse pair. */ TODO: Cache the vector of equivalent vuses per ref, vuse pair. */
void * void *
walk_non_aliased_vuses (ao_ref *ref, tree vuse, walk_non_aliased_vuses (ao_ref *ref, tree vuse,
void *(*walker)(ao_ref *, tree, unsigned int, void *), void *(*walker)(ao_ref *, tree, unsigned int, void *),
void *(*translate)(ao_ref *, tree, void *, bool), void *(*translate)(ao_ref *, tree, void *, bool),
tree (*valueize)(tree),
void *data) void *data)
{ {
bitmap visited = NULL; bitmap visited = NULL;
...@@ -2663,6 +2669,8 @@ walk_non_aliased_vuses (ao_ref *ref, tree vuse, ...@@ -2663,6 +2669,8 @@ walk_non_aliased_vuses (ao_ref *ref, tree vuse,
else if (res != NULL) else if (res != NULL)
break; break;
if (valueize)
vuse = valueize (vuse);
def_stmt = SSA_NAME_DEF_STMT (vuse); def_stmt = SSA_NAME_DEF_STMT (vuse);
if (gimple_nop_p (def_stmt)) if (gimple_nop_p (def_stmt))
break; break;
......
...@@ -124,6 +124,7 @@ extern void *walk_non_aliased_vuses (ao_ref *, tree, ...@@ -124,6 +124,7 @@ extern void *walk_non_aliased_vuses (ao_ref *, tree,
void *(*)(ao_ref *, tree, void *(*)(ao_ref *, tree,
unsigned int, void *), unsigned int, void *),
void *(*)(ao_ref *, tree, void *, bool), void *(*)(ao_ref *, tree, void *, bool),
tree (*)(tree),
void *); void *);
extern unsigned int walk_aliased_vdefs (ao_ref *, tree, extern unsigned int walk_aliased_vdefs (ao_ref *, tree,
bool (*)(ao_ref *, tree, void *), bool (*)(ao_ref *, tree, void *),
......
...@@ -2635,7 +2635,7 @@ lookup_avail_expr (gimple stmt, bool insert) ...@@ -2635,7 +2635,7 @@ lookup_avail_expr (gimple stmt, bool insert)
&& TREE_CODE (gimple_assign_lhs (stmt)) == SSA_NAME && TREE_CODE (gimple_assign_lhs (stmt)) == SSA_NAME
&& (ao_ref_init (&ref, gimple_assign_rhs1 (stmt)), true) && (ao_ref_init (&ref, gimple_assign_rhs1 (stmt)), true)
&& walk_non_aliased_vuses (&ref, vuse2, && walk_non_aliased_vuses (&ref, vuse2,
vuse_eq, NULL, vuse1) != NULL)) vuse_eq, NULL, NULL, vuse1) != NULL))
{ {
struct expr_hash_elt *element2 = XNEW (struct expr_hash_elt); struct expr_hash_elt *element2 = XNEW (struct expr_hash_elt);
*element2 = element; *element2 = element;
......
...@@ -2160,7 +2160,8 @@ vn_reference_lookup_pieces (tree vuse, alias_set_type set, tree type, ...@@ -2160,7 +2160,8 @@ vn_reference_lookup_pieces (tree vuse, alias_set_type set, tree type,
*vnresult = *vnresult =
(vn_reference_t)walk_non_aliased_vuses (&r, vr1.vuse, (vn_reference_t)walk_non_aliased_vuses (&r, vr1.vuse,
vn_reference_lookup_2, vn_reference_lookup_2,
vn_reference_lookup_3, &vr1); vn_reference_lookup_3,
vn_valueize, &vr1);
gcc_checking_assert (vr1.operands == shared_lookup_references); gcc_checking_assert (vr1.operands == shared_lookup_references);
} }
...@@ -2212,7 +2213,8 @@ vn_reference_lookup (tree op, tree vuse, vn_lookup_kind kind, ...@@ -2212,7 +2213,8 @@ vn_reference_lookup (tree op, tree vuse, vn_lookup_kind kind,
wvnresult = wvnresult =
(vn_reference_t)walk_non_aliased_vuses (&r, vr1.vuse, (vn_reference_t)walk_non_aliased_vuses (&r, vr1.vuse,
vn_reference_lookup_2, vn_reference_lookup_2,
vn_reference_lookup_3, &vr1); vn_reference_lookup_3,
vn_valueize, &vr1);
gcc_checking_assert (vr1.operands == shared_lookup_references); gcc_checking_assert (vr1.operands == shared_lookup_references);
if (wvnresult) if (wvnresult)
{ {
......
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