[OpenMP][FIX] Restrict more unsound assmptions about threading
authorJohannes Doerfert <johannes@jdoerfert.de>
Wed, 14 Dec 2022 06:00:15 +0000 (22:00 -0800)
committerJohannes Doerfert <johannes@jdoerfert.de>
Wed, 14 Dec 2022 06:58:33 +0000 (22:58 -0800)
commit07c375348083170e39c9498a42a9679c7e08f07f
treeba793b22e6b3a1b1931c2b5a180e16b73ea8be9d
parent36a879e80f8179358001a7a6cfad7adec6e02504
[OpenMP][FIX] Restrict more unsound assmptions about threading

Even if all loads and stores are in `nosync` functions we cannot
guarantee there is no synchronization going on between them. As such, we
cannot use CFG reasoning. We could check the entire module, or, what
happens now to minimize test churn, is to check if all accesses are in
the same function that is `nosync`. A follow up will undo some of the
regressions where possible.

Similarly, reachability cannot be used to exclude an access if the
access is not known to be executed by the same thread as the given
instruction.

The OpenMP-opt test was added for the latter problem.
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/test/Transforms/Attributor/IPConstantProp/return-argument.ll
llvm/test/Transforms/Attributor/internal-noalias.ll
llvm/test/Transforms/Attributor/value-simplify-assume.ll
llvm/test/Transforms/Attributor/value-simplify-gpu.ll
llvm/test/Transforms/Attributor/value-simplify-reachability.ll
llvm/test/Transforms/OpenMP/value-simplify-openmp-opt.ll [new file with mode: 0644]