https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68718

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
As said GCC with IPA PTA sees that busy is a stack-local var (in the omp-data
in main) and thus cannot be accessed by omp_set/unset_lock which means they
do not alias.

Aliasing is not a precise enough vehicle to track "lock dependences".

  # USE = nonlocal { D.2027 } (escaped)
  # CLB = nonlocal { D.2027 } (escaped)
  omp_set_lock (_15);

here 'busy' is neither nonlocal (in another TU) nor escaped (to other TUs).
It aliases 'lock' (D.2027 in main, having its address passed to the OMP fn
via omp-data).

GCC is simply too clever now to make that "we don't implement lock dependences"
issue papered over by alias missed optimizations...

We could continue to paper over this with some alias magic in the
tree-ssa-alias.c
stmt disambiguators as long as the locking functions are builtins.  And we
could
propagate a cgraph flag "uses-locks" for other functions IPA PTA might look at
(or conservatively "does not use locks").

Or paper over it in IPA PTA and not emit clobber/use info for lock function
calls (are they even builtins, it doesn't seem so ...)

Reply via email to