On 1/17/23 12:09, Jakub Jelinek wrote:
On Tue, Jan 17, 2023 at 11:59:53AM +0100, Aldy Hernandez wrote:


On 1/17/23 10:47, Jakub Jelinek wrote:

Aldy/Andrew, is the ranger query ok or should I use something different
when check_range_stmt is non-NULL and I know on which statement to ask?

<snip>

+         int_range_max r;
+         if (!get_global_range_query ()->range_of_expr (r, rotcnt,
+                                                        check_range_stmt))
+           return false;

range_of_expr will work with and without a statement.  If no statement is
provided, it will return the global range.  So you can use the same
range_of_expr call with a statement or without one if you don't know it.

Note that get_global_range_query () will always return a global query object
(think SSA_NAME_RANGE_INFO).  It will never use an existing ranger (for
example, if called within VRP or another pass that has an active ranger
enabled).  If simplify_rotate() may be used from some of these passes you
*may* want to use get_range_query() which will pick up the active ranger, or
a global query object if no ranger is active.

This is always in the forwprop pass.
I think it doesn't have any active ranger instance, but I could be wrong.

A question would be if it would be worth to activate it in this spot lazily
if it isn't active yet (and destruct at the end of the pass).

That's what it was designed for :). If you're making sporadic requests, the on-demand mechanism should be fast enough.

Aldy

Reply via email to