On 8/18/26 08:47, Richard Biener wrote:
On Tue, Aug 18, 2026 at 2:40 PM Aldy Hernandez <[email protected]> wrote:
On Tue, Aug 18, 2026 at 12:53:20PM +0200, Richard Biener wrote:
On Tue, Aug 18, 2026 at 12:30 PM Aldy Hernandez <[email protected]> wrote:
Are there not in-BB side-effects to ranges that might or might not be reflected?
I'm not sure it's sensible to use path ranger as current query.
Side effects are block granular, in both rangers AFAIK, so a mid fold
query through the path ranger either gets the global range or a cached
value from everything seen so far in the path. So I think we should
be OK.
However, if we're using the path ranger to ask things from the path,
but expecting a root ranger response, that's bound to fail. To be
honest, we haven't stressed the path ranger outside of the backwards
threader much (maybe loop-ch and loop unswitching??). So the
conservative option may be not to ask the path ranger itself, or bail
if the cache hasn't been set up?
I think it's weird to end up with path ranger as query and we should
have fallen back to a "below" active ranger or global ranges. I'd
have expected path ranger queries to explicitly go to it, not via
the get_range_query () active one. Or is the gimple_ranger
instantiated by the back threader "tainted" somehow, even
when not using a path_range_query constructed from it?
Richard.
THe path ranger using the a main ranger for all queries which extend
outside the path.. this allows all known info leading into the path to
be handled properly. It seems reasonable that any request to the path
ranger for values outside the path should go the root ranger.
in tree-ssa-dom.cc I see:
/* Recursively walk the dominator tree optimizing statements. */
gimple_ranger *ranger = enable_ranger (fun);
path_range_query path_query (*ranger);
This would be what was happening before my change.. the path ranger
doing its thing, and then called into fold and the simplifier was then
invoking get_range_query() which would then be the root ranger.
We should se the same results if the path ranger queries simply invoke
the root ranger if the request is from outside the block.
If its from within the path, i would think you would want the values
from within the path.. but thats above my paygrade :-P
Andrew