diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-12-20 12:52:37 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-12-20 12:52:37 +0000 |
commit | 30acf2829633b900ea5fe9a3a00aad1e9a84bf43 (patch) | |
tree | f72f7530acb32b59e21e928608e3d12b5d8f3e97 /gcc/gimple-fold.c | |
parent | 74c74aa05ee8757210dfb16f6198024e6dc445d5 (diff) | |
download | gcc-30acf2829633b900ea5fe9a3a00aad1e9a84bf43.zip gcc-30acf2829633b900ea5fe9a3a00aad1e9a84bf43.tar.gz gcc-30acf2829633b900ea5fe9a3a00aad1e9a84bf43.tar.bz2 |
poly_int: fold_ctor_reference
This patch changes the offset and size arguments to
fold_ctor_reference from unsigned HOST_WIDE_INT to poly_uint64.
2017-12-20 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* gimple-fold.h (fold_ctor_reference): Take the offset and size
as poly_uint64 rather than unsigned HOST_WIDE_INT.
* gimple-fold.c (fold_ctor_reference): Likewise.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r255869
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r-- | gcc/gimple-fold.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 87ce3d8..285ece2 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -6527,20 +6527,25 @@ fold_nonarray_ctor_reference (tree type, tree ctor, return build_zero_cst (type); } -/* CTOR is value initializing memory, fold reference of type TYPE and size SIZE - to the memory at bit OFFSET. */ +/* CTOR is value initializing memory, fold reference of type TYPE and + size POLY_SIZE to the memory at bit POLY_OFFSET. */ tree -fold_ctor_reference (tree type, tree ctor, unsigned HOST_WIDE_INT offset, - unsigned HOST_WIDE_INT size, tree from_decl) +fold_ctor_reference (tree type, tree ctor, poly_uint64 poly_offset, + poly_uint64 poly_size, tree from_decl) { tree ret; /* We found the field with exact match. */ if (useless_type_conversion_p (type, TREE_TYPE (ctor)) - && !offset) + && known_eq (poly_offset, 0U)) return canonicalize_constructor_val (unshare_expr (ctor), from_decl); + /* The remaining optimizations need a constant size and offset. */ + unsigned HOST_WIDE_INT size, offset; + if (!poly_size.is_constant (&size) || !poly_offset.is_constant (&offset)) + return NULL_TREE; + /* We are at the end of walk, see if we can view convert the result. */ if (!AGGREGATE_TYPE_P (TREE_TYPE (ctor)) && !offset |