public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-258] Convert compare_nonzero_chars to wide_ints. Date: Wed, 26 Apr 2023 11:50:31 +0000 (GMT) [thread overview] Message-ID: <20230426115031.16C423850876@sourceware.org> (raw) https://gcc.gnu.org/g:fb5607ae6ad468fe1183b7a3b392d445010ada41 commit r14-258-gfb5607ae6ad468fe1183b7a3b392d445010ada41 Author: Aldy Hernandez <aldyh@redhat.com> Date: Thu Mar 2 16:56:12 2023 +0100 Convert compare_nonzero_chars to wide_ints. gcc/ChangeLog: * tree-ssa-strlen.cc (compare_nonzero_chars): Convert to wide_ints. Diff: --- gcc/tree-ssa-strlen.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/tree-ssa-strlen.cc b/gcc/tree-ssa-strlen.cc index 0bbcb04834f..de785281b27 100644 --- a/gcc/tree-ssa-strlen.cc +++ b/gcc/tree-ssa-strlen.cc @@ -359,10 +359,10 @@ compare_nonzero_chars (strinfo *si, gimple *stmt, of the length range are equal return the result of the comparison same as in the constant case. Otherwise return a conservative result. */ - tree lower = wide_int_to_tree (vr.type (), vr.lower_bound ()); - tree upper = wide_int_to_tree (vr.type (), vr.upper_bound ()); - int cmpmin = compare_tree_int (lower, off); - if (cmpmin > 0 || tree_int_cst_equal (lower, upper)) + signop sign = TYPE_SIGN (vr.type ()); + unsigned prec = TYPE_PRECISION (vr.type ()); + int cmpmin = wi::cmp (vr.lower_bound (), wi::uhwi (off, prec), sign); + if (cmpmin > 0 || vr.singleton_p ()) return cmpmin; return -1;
reply other threads:[~2023-04-26 11:50 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=20230426115031.16C423850876@sourceware.org \ --to=aldyh@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).