Commit d0ca0bcb by Richard Guenther Committed by Richard Biener

re PR tree-optimization/42108 (50% performance regression)

2009-12-19  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42108
	* tree-ssa-sccvn.c (last_vuse_ptr): New variable.
	(vn_reference_lookup_2): Update last seen VUSE.
	(vn_reference_lookup_3): Avoid updating last seen VUSE after
	translating.
	(visit_reference_op_load): Use last seen VUSE from the first
	lookup when entering into the table.

	* gfortran.dg/pr42108.f90: New testcase.

From-SVN: r155360
parent a8572b62
2009-12-19 Richard Guenther <rguenther@suse.de>
PR tree-optimization/42108
* tree-ssa-sccvn.c (last_vuse_ptr): New variable.
(vn_reference_lookup_2): Update last seen VUSE.
(vn_reference_lookup_3): Avoid updating last seen VUSE after
translating.
(visit_reference_op_load): Use last seen VUSE from the first
lookup when entering into the table.
2009-12-19 Joern Rennecke <amylaar@spamcop.net>
* Makefile.in (PLUGIN_HEADERS): Add more headers.
2009-12-19 Richard Guenther <rguenther@suse.de>
PR tree-optimization/42108
* gfortran.dg/pr42108.f90: New testcase.
2009-12-18 Jason Merrill <jason@redhat.com>
PR c++/28300
......
! { dg-do compile }
! { dg-options "-O2 -fdump-tree-fre" }
subroutine eval(foo1,foo2,foo3,foo4,x,n,nnd)
implicit real*8 (a-h,o-z)
dimension foo3(n),foo4(n),x(nnd)
nw=0
foo3(1)=foo2*foo4(1)
do i=2,n
foo3(i)=foo2*foo4(i)
do j=1,i-1
temp=0.0d0
jmini=j-i
do k=i,nnd,n
temp=temp+(x(k)-x(k+jmini))**2
end do
temp = sqrt(temp+foo1)
foo3(i)=foo3(i)+temp*foo4(j)
foo3(j)=foo3(j)+temp*foo4(i)
end do
end do
end subroutine eval
! There should be only one load from n left
! { dg-final { scan-tree-dump-times "\\*n_" 1 "fre" } }
! { dg-final { cleanup-tree-dump "fre" } }
......@@ -984,6 +984,8 @@ vn_reference_lookup_1 (vn_reference_t vr, vn_reference_t *vnresult)
return NULL_TREE;
}
static tree *last_vuse_ptr;
/* Callback for walk_non_aliased_vuses. Adjusts the vn_reference_t VR_
with the current VUSE and performs the expression lookup. */
......@@ -994,6 +996,9 @@ vn_reference_lookup_2 (ao_ref *op ATTRIBUTE_UNUSED, tree vuse, void *vr_)
void **slot;
hashval_t hash;
if (last_vuse_ptr)
*last_vuse_ptr = vuse;
/* Fixup vuse and hash. */
vr->hashcode = vr->hashcode - iterative_hash_expr (vr->vuse, 0);
vr->vuse = SSA_VAL (vuse);
......@@ -1161,6 +1166,9 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_)
return (void *)-1;
*ref = r;
/* Do not update last seen VUSE after translating. */
last_vuse_ptr = NULL;
/* Keep looking for the adjusted *REF / VR pair. */
return NULL;
}
......@@ -1961,7 +1969,13 @@ static bool
visit_reference_op_load (tree lhs, tree op, gimple stmt)
{
bool changed = false;
tree result = vn_reference_lookup (op, gimple_vuse (stmt), true, NULL);
tree last_vuse;
tree result;
last_vuse = gimple_vuse (stmt);
last_vuse_ptr = &last_vuse;
result = vn_reference_lookup (op, gimple_vuse (stmt), true, NULL);
last_vuse_ptr = NULL;
/* If we have a VCE, try looking up its operand as it might be stored in
a different type. */
......@@ -2045,7 +2059,7 @@ visit_reference_op_load (tree lhs, tree op, gimple stmt)
else
{
changed = set_ssa_val_to (lhs, lhs);
vn_reference_insert (op, lhs, gimple_vuse (stmt));
vn_reference_insert (op, lhs, last_vuse);
}
return changed;
......
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