[clang] [llvm] [openmp] [OpenMP] Honour memory-order clauses on the flush directive (PR #241295)
Julian Brown via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 24 03:04:56 PST 2026
================
@@ -6262,18 +6262,39 @@ void CodeGenFunction::EmitOMPTaskgroupDirective(
}
void CodeGenFunction::EmitOMPFlushDirective(const OMPFlushDirective &S) {
- llvm::AtomicOrdering AO = S.getSingleClause<OMPFlushClause>()
- ? llvm::AtomicOrdering::NotAtomic
- : llvm::AtomicOrdering::AcquireRelease;
- CGM.getOpenMPRuntime().emitFlush(
- *this,
- [&S]() -> ArrayRef<const Expr *> {
- if (const auto *FlushClause = S.getSingleClause<OMPFlushClause>())
- return llvm::ArrayRef(FlushClause->varlist_begin(),
- FlushClause->varlist_end());
- return {};
- }(),
- S.getBeginLoc(), AO);
+ llvm::AtomicOrdering AO = llvm::AtomicOrdering::AcquireRelease;
+ // OpenMP 5.0 (2.17.8): a flush with no list and no memory order clause
+ // behaves as acq_rel.
+ // OpenMP 5.1 (2.19.8): same, but seq_cst.
+ if (CGM.getLangOpts().OpenMP >= 51)
----------------
jtb20 wrote:
Fixed, thanks.
https://github.com/llvm/llvm-project/pull/241295
More information about the cfe-commits
mailing list