diff options
| author | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-03-06 21:56:04 +0000 |
|---|---|---|
| committer | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-03-06 21:56:04 +0000 |
| commit | 6e6e51e5f4784ef28dccb977cedc6eea7747fe25 (patch) | |
| tree | 571a3a53a75436d921342817d1fe0b19f2685dc9 | |
| parent | e2b8cf9832c4dc452ac2ac312d6eb41599f5f89f (diff) | |
| download | ppe42-gcc-6e6e51e5f4784ef28dccb977cedc6eea7747fe25.tar.gz ppe42-gcc-6e6e51e5f4784ef28dccb977cedc6eea7747fe25.zip | |
2008-03-06 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/35402
* tree-ssa-ccp.c (get_symbol_constant_value): Handle
integral and scalar float variables which have a
NULL DECL_INITIAL.
2008-03-06 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/35402
* gcc.dg/tree-ssa/ssa-store-ccp-1.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132991 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 7 | ||||
| -rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-1.c | 14 | ||||
| -rw-r--r-- | gcc/tree-ssa-ccp.c | 6 |
4 files changed, 32 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5b3525037d9..d3a2325d2b6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2008-03-06 Andrew Pinski <andrew_pinski@playstation.sony.com> + + PR tree-opt/35402 + * tree-ssa-ccp.c (get_symbol_constant_value): Handle + integral and scalar float variables which have a + NULL DECL_INITIAL. + 2008-03-06 Nathan Froyd <froydnj@codesourcery.com> * dwarf2out.c (dwarf2out_frame_debug_expr): Consult the diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 38bf08d7db9..b24b8daa07b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-03-06 Andrew Pinski <andrew_pinski@playstation.sony.com> + + PR tree-opt/35402 + * gcc.dg/tree-ssa/ssa-store-ccp-1.c: New test. + 2008-03-06 Markus Milleder <markus.milleder@generali.at> PR preprocessor/35458 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-1.c new file mode 100644 index 00000000000..aaa3d13cad4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +static const int conststaticvariable; + +int f(void) +{ + return conststaticvariable; +} + +/* There should be no reference to conststaticvariable as we should have + inlined the 0. */ +/* { dg-final { scan-tree-dump-times "conststaticvariable" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index f9f1217c5fc..b9211a5df9c 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -306,6 +306,12 @@ get_symbol_constant_value (tree sym) if (val && ccp_decl_initial_min_invariant (val)) return val; + /* Variables declared 'const' without an initializer + have zero as the intializer. */ + if (!val + && (INTEGRAL_TYPE_P (TREE_TYPE (sym)) + || SCALAR_FLOAT_TYPE_P (TREE_TYPE (sym)))) + return fold_convert (TREE_TYPE (sym), integer_zero_node); } return NULL_TREE; |

