re PR tree-optimization/35402 (Store CCP will not inline static const variable which is default initialized)
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. From-SVN: r132991
This commit is contained in:
parent
39897cdcb0
commit
b094015443
4 changed files with 32 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
14
gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-1.c
Normal file
14
gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-1.c
Normal file
|
@ -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" } } */
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue