On 1/17/23 12:33, Jakub Jelinek wrote:
On Tue, Jan 17, 2023 at 12:22:42PM +0100, Aldy Hernandez wrote:
On 1/17/23 12:19, Jakub Jelinek wrote:
On Tue, Jan 17, 2023 at 12:14:14PM +0100, Aldy Hernandez wrote:
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.
So what should be done to do the on-demand query rather than global one?
gimple_ranger ranger;
if (ranger.range_of_expr (r, .....))
// business as usual
So not worth making the ranger somewhere in the pass (if it is really
sporadic like this one)?
If you're going to call range_of_expr various times within a pass,
creating a pass instance would be the way to go.
// Early in your pass.
enable_ranger (func);
...
if (get_range_query->range_of_expr (....))
{ stuff }
// Late in your pass:
disable_ranger (func);
Note that get_range_query() would work even without enable_ranger...it
would just pick up the global ranger (SSA_NAME_RANGE_INFO).
Aldy
Will test together with the removal of B from the range.
Jakub