On Mon 2026-11-02 12:52:25, Andrew MacLeod wrote:
> Thre is only one place (!!!!) that actually sets pt.null to 0  (meaning the
> range is nonnull)   It is in tree-ssa-structalias.cc find_what_p_points_to()
> and it determines nonnullness based on :
> 
>  get_range_query (DECL_STRUCT_FUNCTION (fndecl))->range_of_expr (vr, p);
>  bool nonnull = !vr.contains_zero_p ();
> <..>
>   if (nonnull)
>     set_ptr_nonnull (p);

It's actually not true, that this is the only place that sets pt.null to 0 --
find_what_var_points_to() can also produce pt_solution pt with pt.null = 0
(when it creates the structure, it zero-initializes it by memset).  Yes, in
find_what_pt_points_to() that gets overriden to whatever ranger thinks about
null-ness of a pointer.  But that's not the only place
find_what_var_points_to() is called.

On the other hand, when you look at the other calls to
find_what_var_points_to(), you see that those are only used to compute the
(IPA) escaped, escaped_return, IPA clobbers and IPA uses.  I didn't check
as thoroughly as I'd like to, but I don't think that GCC ever makes use of
pt_solution.null for those PT sets.

In case it really doesn't, I think we could not only remove pt_solution.null,
but also remove the NULL artificial variable from the PT constraints.  That
would save a little bit of solving time.  For my Steensgaard solver, that
could also be a significant boon in terms of precision.

Cheers,
Filip Kastl

Reply via email to