> On Thu, 7 Apr 2022, Jan Hubicka wrote: > > > Hi, > > this patch fixes miscompilation of gnatmake. Modref attempts to track > > memory > > accesses relative to the base pointers which are parameters of functions. > > If it fails, it still makes difference between unknown memory access and > > global memory access. The second makes it possible to disambiguate with > > memory that is not accessible from outside world (i.e. everything that does > > not escape from the caller function). This is useful so we do not punt > > when unknown function is called. > > > > Now I added ref_may_access_global_memory_p to tree-ssa-alias whic is using > > ptr_deref_may_alias_global_p. There is however a shift in meaning of this > > predicate: the second tests that the dereference may alias with global > > variable. > > > > In the testcase we are disambiguating heap allocated escaping memory which > > is > > not a global variable but it is still a global memory in the modref's sense. > > So we need to test in addition contains_escaped. > > > > The patch simply copies logic from the predicate and adds the check. > > I am not sure if there is better way to handle this? > > I'm testing the following variant which exposes this detail > (escaped local memory global or not) in the APIs that say "global" > which allows to remove ref_may_access_global_memory_p.
Thank you. Indeed it is better to have an explicit flag, since the clash of names is bit sensitive. Honza