[PATCH] tree-optimization/103168 - Improve VN of pure function calls

Jan Hubicka hubicka@kam.mff.cuni.cz
Wed Nov 24 11:49:35 GMT 2021


> This improves value-numbering of calls that read memory, calls
> to const functions with aggregate arguments and calls to
> pure functions where the latter include const functions we
> demoted to pure for the fear of interposing with a less
> optimized version.  Note that for pure functions we do not
> handle functions that access global memory.

Thank you! I am happy we finally undid some of the pessimization caused
by the interposition panic.  I was wondering if I should try next stage1
start tracking eliminated reads in functions, but that is tricky to do
since things like if (*global_var == *globa_var) is folded already in
frontend.

I was thinking a bit what to do abou global accesses and I think we
still can do something (also next stage1).  

Currently we disambiguate using
  if (stmt_may_clobber_ref_p_1 (def, &ref, true))
where ref is the REF is a ao_ref we built from the summary of STMT and
DEF is another statement.  This is fine but we ignore info we have from
PTA on STMT (the statement we try to optimize).

I we could look at DEF, and try to disambiguate all memory it
writes against STMT using PTA oracle and that would let us to handle
global memory well (we don't need REF for that) because we will work out
that some accesses are not escaping to STMT becaue they are not in
CALLUSED. Somewhat anoying is that we don't have predicate in
tree-ssa-alias for that (stmt_clobber_stmt_p :)

Honza


More information about the Gcc-patches mailing list