As we now have a ranger active during vectorization there's no need
to create a new one. And the stmt argument of range_of_expr is for
the context of the range. Passing the def stmt of expr is equal
to asking for global ranges only (passing NULL as stmt).
Bootstrapped and tested on x86_64-unknown-linux-gnu, I'll push
after giving Andrew some time to comment.
Richard.
* tree-vect-patterns.cc (vect_recog_divmod_pattern): Pass
the division stmt as context for the range query on op0.
Use the active ranger.
---
gcc/tree-vect-patterns.cc | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc
index ab7892b6c7b..e0fbe252163 100644
--- a/gcc/tree-vect-patterns.cc
+++ b/gcc/tree-vect-patterns.cc
@@ -5438,15 +5438,12 @@ vect_recog_divmod_pattern (vec_info *vinfo,
int pow = wi::exact_log2 (wcst + 1);
if (pow == prec / 2)
{
- gimple *stmt = SSA_NAME_DEF_STMT (oprnd0);
-
- gimple_ranger ranger;
- int_range_max r;
-
/* Check that no overflow will occur. If we don't have range
information we can't perform the optimization. */
- if (ranger.range_of_expr (r, oprnd0, stmt) && !r.undefined_p ())
+ int_range_max r;
+ if (get_range_query (cfun)->range_of_expr (r, oprnd0, last_stmt)
+ && !r.undefined_p ())
{
wide_int max = r.upper_bound ();
wide_int one = wi::shwi (1, prec);
--
2.51.0