diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-18 11:45:09 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-18 11:45:09 +0000 |
commit | 37361b38db282048c567fb62a1abd5053bb04399 (patch) | |
tree | 23793781d436a1c62b25d540d256d241df35a7e0 /gcc/testsuite/gcc.dg/tree-ssa/pr19431.c | |
parent | 8c73aef93fc15234cf5f3a861bfca136d27c8e87 (diff) | |
download | gcc-37361b38db282048c567fb62a1abd5053bb04399.tar.gz |
2007-04-18 Richard Guenther <rguenther@suse.de>
PR tree-optimization/19431
PR tree-optimization/21463
* tree-pass.h (pass_phiprop): Declare.
* passes.c (init_optimization_passes): New phiprop pass.
* tree-ssa-forwprop.c (struct phiprop_d): New structure.
(phivn_valid_p): New helper function.
(phiprop_insert_phi): Likewise.
(propagate_with_phi): Likewise.
(tree_ssa_phiprop): New propagator propagating loads
through phi nodes if profitable.
* gcc.c-torture/execute/20070212-1.c: New testcase.
* gcc.c-torture/execute/20070212-2.c: Likewise.
* gcc.c-torture/execute/20070212-3.c: Likewise.
* gcc.dg/tree-ssa/pr19431.c: Likewise.
* gcc.dg/tree-ssa/pr21463.c: Likewise.
* g++.dg/tree-ssa/pr21463.C: Likewise.
* g++.dg/tree-ssa/pr30738.C: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123946 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/pr19431.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/pr19431.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr19431.c b/gcc/testsuite/gcc.dg/tree-ssa/pr19431.c new file mode 100644 index 00000000000..4334648ce64 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr19431.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +/* We want this optimized as +<bb 2>: + if (k != 0) goto <L2>; else goto <L3>; + +<L3>:; + i1 = j1; + +<L2>:; + return i1; + + This requires that i1 and j1 are changed into registers after they + no longer have their address taken. */ + +int f(int k, int i1, int j1) +{ + int *f1; + if(k) + f1 = &i1; + else + f1 = &j1; + return *f1; +} + +/* { dg-final { scan-tree-dump "i1 = j1" "optimized" } } */ +/* { dg-final { scan-tree-dump "return i1;" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ |