diff options
author | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-12 19:00:39 +0000 |
---|---|---|
committer | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-12 19:00:39 +0000 |
commit | 380c5f612a168b4a271b392ac16e202b4088c52d (patch) | |
tree | ce8fe06a4a5b43d55c7335eddbcf12d9026c27d4 | |
parent | 754a9c6cc1b3c2e514a8bfc2472a511a280637b1 (diff) | |
download | gcc-380c5f612a168b4a271b392ac16e202b4088c52d.tar.gz |
2009-06-12 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/38865
* tree-ssa-sccvn.c (visit_reference_op_load): If vn_reference_lookup
is returns NULL and OP is a VCE, look through the VCE.
2009-06-12 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/38865
* gcc.dg/tree-ssa/fre-vce-1.c
:
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148437 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/fre-vce-1.c | 35 | ||||
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 6 |
4 files changed, 52 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 93a0e896d26..2e8f5ebcca2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-06-12 Andrew Pinski <andrew_pinski@playstation.sony.com> + + PR tree-opt/38865 + * tree-ssa-sccvn.c (visit_reference_op_load): If vn_reference_lookup + is returns NULL and OP is a VCE, look through the VCE. + 2009-06-12 Ian Lance Taylor <iant@google.com> PR bootstrap/40430 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b5f0fbc1ed3..8c218933be2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-06-12 Andrew Pinski <andrew_pinski@playstation.sony.com> + + PR tree-opt/38865 + * gcc.dg/tree-ssa/fre-vce-1.c + 2009-06-12 H.J. Lu <hongjiu.lu@intel.com> PR testsuite/40384 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/fre-vce-1.c b/gcc/testsuite/gcc.dg/tree-ssa/fre-vce-1.c new file mode 100644 index 00000000000..f8c12c8d6c5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/fre-vce-1.c @@ -0,0 +1,35 @@ +/* { dg-options "-O2 -fdump-tree-fre -w" } */ +/* { dg-do compile } */ +#define vector __attribute__((vector_size(sizeof(int)*4) )) +struct s { vector int i; }; +vector float f(struct s *sv) +{ + sv->i = (vector int){1, 2, 3, 4}; + return (vector float)sv->i; +} + + +vector float f1(struct s *sv, vector int a) +{ + sv->i = a; + return (vector float)sv->i; +} + +struct s1 { int i; }; + +void g(struct s1 *, float); +void a1 (struct s1 sv) +{ + sv.i = 1; + g(&sv, *(float*)&sv.i); +} + + +void a2 (struct s1 sv, int i) +{ + sv.i = i; + g(&sv, *(float*)&sv.i); +} + +/* { dg-final { scan-tree-dump-times "sv_\[0-9\]\\\(D\\\)->i" 2 "fre" } } */ +/* { dg-final { scan-tree-dump-times "sv.i" 2 "fre" } } */ diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 03fea751feb..6d263ded177 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -1976,6 +1976,12 @@ visit_reference_op_load (tree lhs, tree op, gimple stmt) bool changed = false; tree result = vn_reference_lookup (op, gimple_vuse (stmt), true, NULL); + /* If we have a VCE, try looking up its operand as it might be stored in + a different type. */ + if (!result && TREE_CODE (op) == VIEW_CONVERT_EXPR) + result = vn_reference_lookup (TREE_OPERAND (op, 0), gimple_vuse (stmt), + true, NULL); + /* We handle type-punning through unions by value-numbering based on offset and size of the access. Be prepared to handle a type-mismatch here via creating a VIEW_CONVERT_EXPR. */ |