public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-258] Convert compare_nonzero_chars to wide_ints.
@ 2023-04-26 11:50 Aldy Hernandez
0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2023-04-26 11:50 UTC (permalink / raw)
To: gcc-cvs
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-26 11:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-26 11:50 [gcc r14-258] Convert compare_nonzero_chars to wide_ints Aldy Hernandez
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).