Commit 6aa4c5b6 by Richard Biener Committed by Richard Biener

tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): Rewrite to propagate…

tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): Rewrite to propagate the VN result into all uses where possible and to remove...

2014-06-13  Richard Biener  <rguenther@suse.de>

	* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
	Rewrite to propagate the VN result into all uses where
	possible and to remove stmts becoming dead because of that.
	(eliminate): Generalize stmt removal handling, remove in
	reverse dominator order to support proper debug stmt
	generation.  Update stmts before removing stmts.
	* tree-ssa-propagate.c (propagate_tree_value): Remove
	bogus assert.

	* c-c++-common/pr46562-2.c: Adjust.
	* g++.dg/tree-ssa/pr8781.C: Likewise.
	* gcc.dg/tree-ssa/ssa-fre-24.c: Likewise.
	* gcc.dg/tree-ssa/ssa-fre-25.c: Likewise.
	* gcc.dg/tree-ssa/ssa-fre-32.c: Likewise.
	* gcc.dg/tree-ssa/ssa-fre-39.c: Likewise.
	* gcc.dg/tree-ssa/ssa-pre-16.c: Likewise.

From-SVN: r211625
parent 80298c3b
2014-06-13 Richard Biener <rguenther@suse.de>
* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
Rewrite to propagate the VN result into all uses where
possible and to remove stmts becoming dead because of that.
(eliminate): Generalize stmt removal handling, remove in
reverse dominator order to support proper debug stmt
generation. Update stmts before removing stmts.
* tree-ssa-propagate.c (propagate_tree_value): Remove
bogus assert.
2014-06-13 Thomas Preud'homme <thomas.preudhomme@arm.com> 2014-06-13 Thomas Preud'homme <thomas.preudhomme@arm.com>
PR tree-optimization/61375 PR tree-optimization/61375
......
2014-06-13 Richard Biener <rguenther@suse.de>
* c-c++-common/pr46562-2.c: Adjust.
* g++.dg/tree-ssa/pr8781.C: Likewise.
* gcc.dg/tree-ssa/ssa-fre-24.c: Likewise.
* gcc.dg/tree-ssa/ssa-fre-25.c: Likewise.
* gcc.dg/tree-ssa/ssa-fre-32.c: Likewise.
* gcc.dg/tree-ssa/ssa-fre-39.c: Likewise.
* gcc.dg/tree-ssa/ssa-pre-16.c: Likewise.
2014-06-13 Thomas Preud'homme <thomas.preudhomme@arm.com> 2014-06-13 Thomas Preud'homme <thomas.preudhomme@arm.com>
PR tree-optimization/61375 PR tree-optimization/61375
......
...@@ -9,5 +9,5 @@ int foo(void) ...@@ -9,5 +9,5 @@ int foo(void)
return *p; return *p;
} }
/* { dg-final { scan-tree-dump "= 0;" "fre1" } } */ /* { dg-final { scan-tree-dump "return 0;" "fre1" } } */
/* { dg-final { cleanup-tree-dump "fre1" } } */ /* { dg-final { cleanup-tree-dump "fre1" } } */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O -fno-tree-sra -fdump-tree-fre1-details" } */ /* { dg-options "-O -fno-tree-sra -fdump-tree-fre1" } */
int f(); int f();
...@@ -24,5 +24,5 @@ int x() ...@@ -24,5 +24,5 @@ int x()
/* We should optimize this to a direct call. */ /* We should optimize this to a direct call. */
/* { dg-final { scan-tree-dump "converting indirect call to function int f()" "fre1" } } */ /* { dg-final { scan-tree-dump-times "= f \\(\\);" 1 "fre1" } } */
/* { dg-final { cleanup-tree-dump "fre1" } } */ /* { dg-final { cleanup-tree-dump "fre1" } } */
...@@ -30,5 +30,5 @@ int bazzoo (void) ...@@ -30,5 +30,5 @@ int bazzoo (void)
return b.i; return b.i;
} }
/* { dg-final { scan-tree-dump-times "= 0;" 5 "fre1" } } */ /* { dg-final { scan-tree-dump-times "return 0;" 4 "fre1" } } */
/* { dg-final { cleanup-tree-dump "fre1" } } */ /* { dg-final { cleanup-tree-dump "fre1" } } */
...@@ -14,5 +14,5 @@ int foo (struct X *p) ...@@ -14,5 +14,5 @@ int foo (struct X *p)
/* We should optimize this to return 0. */ /* We should optimize this to return 0. */
/* { dg-final { scan-tree-dump "= 0;" "fre1" } } */ /* { dg-final { scan-tree-dump "return 0;" "fre1" } } */
/* { dg-final { cleanup-tree-dump "fre1" } } */ /* { dg-final { cleanup-tree-dump "fre1" } } */
...@@ -23,6 +23,6 @@ bar (_Complex float x) ...@@ -23,6 +23,6 @@ bar (_Complex float x)
return z; return z;
} }
/* We should CSE all the way to replace the final assignment to z with x. */ /* We should CSE all the way to replace the return value with x. */
/* { dg-final { scan-tree-dump-times "with x_1\\\(D\\\) in z" 3 "fre1" } } */ /* { dg-final { scan-tree-dump-times "return x_\\d\+\\(D\\);" 2 "fre1" } } */
/* { dg-final { cleanup-tree-dump "fre1" } } */ /* { dg-final { cleanup-tree-dump "fre1" } } */
...@@ -15,5 +15,5 @@ int foo (int i) ...@@ -15,5 +15,5 @@ int foo (int i)
/* We should be able to value-number the final assignment to k to 1. */ /* We should be able to value-number the final assignment to k to 1. */
/* { dg-final { scan-tree-dump "k_. = 1;" "fre1" } } */ /* { dg-final { scan-tree-dump "return 1;" "fre1" } } */
/* { dg-final { cleanup-tree-dump "fre1" } } */ /* { dg-final { cleanup-tree-dump "fre1" } } */
...@@ -11,5 +11,5 @@ int foo(int k, int *x) ...@@ -11,5 +11,5 @@ int foo(int k, int *x)
} while (++j<k); } while (++j<k);
return res; return res;
} }
/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ /* { dg-final { scan-tree-dump-times "Eliminated: 2" 1 "pre"} } */
/* { dg-final { cleanup-tree-dump "pre" } } */ /* { dg-final { cleanup-tree-dump "pre" } } */
...@@ -1410,11 +1410,6 @@ replace_exp (use_operand_p op_p, tree val) ...@@ -1410,11 +1410,6 @@ replace_exp (use_operand_p op_p, tree val)
void void
propagate_tree_value (tree *op_p, tree val) propagate_tree_value (tree *op_p, tree val)
{ {
gcc_checking_assert (!(TREE_CODE (val) == SSA_NAME
&& *op_p
&& TREE_CODE (*op_p) == SSA_NAME
&& !may_propagate_copy (*op_p, val)));
if (TREE_CODE (val) == SSA_NAME) if (TREE_CODE (val) == SSA_NAME)
*op_p = val; *op_p = val;
else else
......
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