public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aldyh/heads/ranger-relational)] Resolve symbolics in loop info results.
@ 2021-04-21 17:19 Aldy Hernandez
0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2021-04-21 17:19 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:9fc92dea23701792630d86a0c85d1356243ba7a0
commit 9fc92dea23701792630d86a0c85d1356243ba7a0
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Wed Apr 21 17:33:33 2021 +0200
Resolve symbolics in loop info results.
Diff:
---
gcc/gimple-range-fold.cc | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc
index c8104058796..5d62bd62682 100644
--- a/gcc/gimple-range-fold.cc
+++ b/gcc/gimple-range-fold.cc
@@ -886,13 +886,22 @@ fold_using_range::range_of_ssa_name_with_loop_info (irange &r, tree name,
tree min, max, type = TREE_TYPE (name);
if (bounds_of_var_in_loop (&min, &max, &(src.m_query), l, phi, name))
{
- // ?? We could do better here. Since MIN/MAX can only be an
- // SSA, SSA +- INTEGER_CST, or INTEGER_CST, we could easily call
- // the ranger and solve anything not an integer.
if (TREE_CODE (min) != INTEGER_CST)
- min = vrp_val_min (type);
+ {
+ src.m_query.range_of_expr (r, min, phi);
+ if (r.undefined_p ())
+ min = vrp_val_min (type);
+ else
+ min = wide_int_to_tree (type, r.lower_bound ());
+ }
if (TREE_CODE (max) != INTEGER_CST)
- max = vrp_val_max (type);
+ {
+ src.m_query.range_of_expr (r, max, phi);
+ if (r.undefined_p ())
+ max = vrp_val_max (type);
+ else
+ max = wide_int_to_tree (type, r.upper_bound ());
+ }
r.set (min, max);
}
else
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-21 17:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 17:19 [gcc(refs/users/aldyh/heads/ranger-relational)] Resolve symbolics in loop info results 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).