aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorAndrew Pinski <andrew_pinski@playstation.sony.com>2008-03-06 21:56:04 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2008-03-06 13:56:04 -0800
commitb094015443c17d6ef43ecfb77b01932701e3b4e4 (patch)
tree571a3a53a75436d921342817d1fe0b19f2685dc9 /gcc/tree-ssa-ccp.c
parent39897cdcb0e468dd683a554c1d76c410429d32bc (diff)
downloadgcc-b094015443c17d6ef43ecfb77b01932701e3b4e4.zip
gcc-b094015443c17d6ef43ecfb77b01932701e3b4e4.tar.gz
gcc-b094015443c17d6ef43ecfb77b01932701e3b4e4.tar.bz2
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
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index f9f1217..b9211a5 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;