Skip to content

Commit bd802d4

Browse files
authored
[Clang][AMDGPU] Stop defaulting to one-as for all atomic scopes (llvm#120095) (llvm#1536)
2 parents 403d4e6 + c70c394 commit bd802d4

File tree

4 files changed

+235
-229
lines changed

4 files changed

+235
-229
lines changed

clang/lib/CodeGen/Targets/AMDGPU.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,11 @@ AMDGPUTargetCodeGenInfo::getLLVMSyncScopeID(const LangOptions &LangOpts,
530530
break;
531531
}
532532

533-
if (Ordering != llvm::AtomicOrdering::SequentiallyConsistent) {
533+
// OpenCL assumes by default that atomic scopes are per-address space for
534+
// non-sequentially consistent operations.
535+
if (Scope >= SyncScope::OpenCLWorkGroup &&
536+
Scope <= SyncScope::OpenCLSubGroup &&
537+
Ordering != llvm::AtomicOrdering::SequentiallyConsistent) {
534538
if (!Name.empty())
535539
Name = Twine(Twine(Name) + Twine("-")).str();
536540

0 commit comments

Comments
 (0)