Page MenuHomePhabricator

[OpenMP] Eliminate redundant barriers in the same block

Authored by jdoerfert on Jan 23 2022, 11:40 AM.



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.

Diff Detail

Event Timeline

jdoerfert created this revision.Jan 23 2022, 11:40 AM
jdoerfert requested review of this revision.Jan 23 2022, 11:40 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJan 23 2022, 11:40 AM


ormris removed a subscriber: ormris.Jan 24 2022, 11:06 AM
jhuber6 accepted this revision.Jan 25 2022, 9:40 AM
This revision is now accepted and ready to land.Jan 25 2022, 9:40 AM
This revision was automatically updated to reflect the committed changes.