public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Siddhesh Poyarekar <siddhesh@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-6056] tree-optimization/103759: Use sizetype everywhere for object sizes Date: Sat, 18 Dec 2021 11:17:39 +0000 (GMT) [thread overview] Message-ID: <20211218111739.546283858401@sourceware.org> (raw) https://gcc.gnu.org/g:cc032ec1ecb34b006f42e170ccb9d76aa42fd8eb commit r12-6056-gcc032ec1ecb34b006f42e170ccb9d76aa42fd8eb Author: Siddhesh Poyarekar <siddhesh@gotplt.org> Date: Sat Dec 18 16:46:43 2021 +0530 tree-optimization/103759: Use sizetype everywhere for object sizes Since all computations in tree-object-size are now done in sizetype and not HOST_WIDE_INT, comparisons with HOST_WIDE_INT based unknown and initval would be incorrect. Instead, use the sizetype trees directly to generate and evaluate initval and unknown size values. gcc/ChangeLog: PR tree-optimization/103759 * tree-object-size.c (unknown, initval): Remove functions. (size_unknown, size_initval, size_unknown_p): Operate directly on trees. Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org> Diff: --- gcc/tree-object-size.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c index 71f6b747d05..ee9ea1bfbfd 100644 --- a/gcc/tree-object-size.c +++ b/gcc/tree-object-size.c @@ -83,30 +83,13 @@ static bitmap computed[OST_END]; /* Maximum value of offset we consider to be addition. */ static unsigned HOST_WIDE_INT offset_limit; -/* Initial value of object sizes; zero for maximum and SIZE_MAX for minimum - object size. */ - -static inline unsigned HOST_WIDE_INT -initval (int object_size_type) -{ - return (object_size_type & OST_MINIMUM) ? HOST_WIDE_INT_M1U : 0; -} - -/* Unknown object size value; it's the opposite of initval. */ - -static inline unsigned HOST_WIDE_INT -unknown (int object_size_type) -{ - return ~initval (object_size_type); -} - /* Return true if VAL is represents an unknown size for OBJECT_SIZE_TYPE. */ static inline bool size_unknown_p (tree val, int object_size_type) { - return (tree_fits_uhwi_p (val) - && tree_to_uhwi (val) == unknown (object_size_type)); + return ((object_size_type & OST_MINIMUM) + ? integer_zerop (val) : integer_all_onesp (val)); } /* Return a tree with initial value for OBJECT_SIZE_TYPE. */ @@ -114,7 +97,8 @@ size_unknown_p (tree val, int object_size_type) static inline tree size_initval (int object_size_type) { - return size_int (initval (object_size_type)); + return ((object_size_type & OST_MINIMUM) + ? TYPE_MAX_VALUE (sizetype) : size_zero_node); } /* Return a tree with unknown value for OBJECT_SIZE_TYPE. */ @@ -122,7 +106,8 @@ size_initval (int object_size_type) static inline tree size_unknown (int object_size_type) { - return size_int (unknown (object_size_type)); + return ((object_size_type & OST_MINIMUM) + ? size_zero_node : TYPE_MAX_VALUE (sizetype)); } /* Grow object_sizes[OBJECT_SIZE_TYPE] to num_ssa_names. */
reply other threads:[~2021-12-18 11:17 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211218111739.546283858401@sourceware.org \ --to=siddhesh@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).