diff options
author | Richard Guenther <rguenther@suse.de> | 2008-08-21 16:15:08 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-08-21 16:15:08 +0000 |
commit | c76a1f1838c73fdf4caa61e776bfcdc9afabb408 (patch) | |
tree | 1ade2292fbb0e32211932a86c3ef59a327851403 /gcc | |
parent | c7c6340790771cf22e77dc2be248ecd03aa722fe (diff) | |
download | gcc-c76a1f1838c73fdf4caa61e776bfcdc9afabb408.zip gcc-c76a1f1838c73fdf4caa61e776bfcdc9afabb408.tar.gz gcc-c76a1f1838c73fdf4caa61e776bfcdc9afabb408.tar.bz2 |
tree-ssa-ccp.c (ccp_fold): Fold VIEW_CONVERT_EXPRs of constants.
2008-08-21 Richard Guenther <rguenther@suse.de>
* tree-ssa-ccp.c (ccp_fold): Fold VIEW_CONVERT_EXPRs of constants.
* gcc.dg/vect/vect-fold-1.c: Scan ccp1 dump instead of dom1.
From-SVN: r139398
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-fold-1.c | 6 | ||||
-rw-r--r-- | gcc/tree-ssa-ccp.c | 12 |
4 files changed, 22 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d63db92..d29b385 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2008-08-21 Richard Guenther <rguenther@suse.de> + + * tree-ssa-ccp.c (ccp_fold): Fold VIEW_CONVERT_EXPRs of constants. + 2008-08-21 Jan Hubicka <jh@suse.cz> * cgraph.c (first_cgraph_function_insertion_hook): New variable. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4cade5a..74ed9f9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2008-08-21 Richard Guenther <rguenther@suse.de> + * gcc.dg/vect/vect-fold-1.c: Scan ccp1 dump instead of dom1. + +2008-08-21 Richard Guenther <rguenther@suse.de> + PR middle-end/36817 * gcc.c-torture/compile/pr36817.c: New testcase. diff --git a/gcc/testsuite/gcc.dg/vect/vect-fold-1.c b/gcc/testsuite/gcc.dg/vect/vect-fold-1.c index 88b68b7..8aca1e4 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-fold-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-fold-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-dom1" } */ +/* { dg-options "-O2 -fdump-tree-ccp1" } */ typedef unsigned char v4qi __attribute__ ((vector_size (4))); @@ -12,5 +12,5 @@ void foo() c = a + b; } -/* { dg-final { scan-tree-dump-times "c = { 6, 8, 10, 12 }" 1 "dom1" } } */ -/* { dg-final { cleanup-tree-dump "dom1" } } */ +/* { dg-final { scan-tree-dump-times "c =.* { 6, 8, 10, 12 }" 1 "ccp1" } } */ +/* { dg-final { cleanup-tree-dump "ccp1" } } */ diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index cd50ad4..57aa473 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -961,7 +961,17 @@ ccp_fold (gimple stmt) } if (kind == tcc_reference) - return fold_const_aggregate_ref (rhs); + { + if (TREE_CODE (rhs) == VIEW_CONVERT_EXPR + && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME) + { + prop_value_t *val = get_value (TREE_OPERAND (rhs, 0)); + if (val->lattice_val == CONSTANT) + return fold_unary (VIEW_CONVERT_EXPR, + TREE_TYPE (rhs), val->value); + } + return fold_const_aggregate_ref (rhs); + } else if (kind == tcc_declaration) return get_symbol_constant_value (rhs); return rhs; |