diff options
author | Jan Hubicka <jh@suse.cz> | 2010-09-13 18:37:06 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2010-09-13 16:37:06 +0000 |
commit | e196b22163a6c1a723648b3f09501ebd586fa1c0 (patch) | |
tree | be54f7c64c42685735916f091dcaff628b5c5255 /gcc/tree.c | |
parent | ac42c96090394e592af5e835412b73db6e424594 (diff) | |
download | gcc-e196b22163a6c1a723648b3f09501ebd586fa1c0.tar.gz |
tree.c (build_zero_cst): New.
* tree.c (build_zero_cst): New.
* tree.h (build_zero_cst): Declare.
* tree-ssa-ccp.c (get_constant_value): Accept general operands.
(get_base_constructor): Break out from ...
(fold_const_aggregate_ref): Here; handle empty constructors.
* gcc.dg/torture/pr23821.c: Drop static keyword.
* gcc.dg/tree-ssa/loop-19.c: Likewise.
* gcc.dg/tree-ssa/foldconst-4.c: New.
From-SVN: r164250
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c index c20d3b6c5ce..fd593e39ebd 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1583,6 +1583,18 @@ build_one_cst (tree type) } } +/* Build 0 constant of type TYPE. This is used by constructor folding and thus + the constant should correspond zero in memory representation. */ + +tree +build_zero_cst (tree type) +{ + if (!AGGREGATE_TYPE_P (type)) + return fold_convert (type, integer_zero_node); + return build_constructor (type, NULL); +} + + /* Build a BINFO with LEN language slots. */ tree |