[PATCH] D118002: [OpenMP] Eliminate redundant barriers in the same block

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 23 11:40:07 PST 2022


jdoerfert created this revision.
jdoerfert added reviewers: ggeorgakoudis, jhuber6.
Herald added subscribers: ormris, guansong, bollu, hiraditya, yaxunl.
jdoerfert requested review of this revision.
Herald added subscribers: llvm-commits, sstefan1.
Herald added projects: OpenMP, LLVM.

Patch originally by Giorgis Georgakoudis (@ggeorgakoudis), typos and
bugs introduced later by me.

This patch allows us to remove redundant barriers if they are part
of a "consecutive" pair of barriers in a basic block with no impacted
memory effect (read or write) in-between them. Memory accesses to
local (=thread private) or constant memory are allowed to appear.
Technically we could also allow any other memory that is not used to
share information between threads, e.g., the result of a malloc that
is also not captured. However, it will be easier to do more reasoning
once the code is put into an AA. That will also allow us to look through
phis/selects reasonably. At that point we should also deal with calls,
barriers in different blocks, and other complexities.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118002

Files:
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/test/Transforms/OpenMP/barrier_removal.ll
  openmp/docs/remarks/OMP180.rst
  openmp/docs/remarks/OMP190.rst
  openmp/docs/remarks/OptimizationRemarks.rst

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118002.402361.patch
Type: text/x-patch
Size: 22829 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220123/f4e9c303/attachment.bin>


More information about the llvm-commits mailing list