[all-commits] [llvm/llvm-project] bf14b9: [OpenMP] Mark critical region lock variables as ds...
Shivam Gupta via All-commits
all-commits at lists.llvm.org
Mon Jun 8 22:13:21 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: bf14b9ff2a61daed7a4bae710908f12b467568d6
https://github.com/llvm/llvm-project/commit/bf14b9ff2a61daed7a4bae710908f12b467568d6
Author: Shivam Gupta <shivam98.tkg at gmail.com>
Date: 2026-06-09 (Tue, 09 Jun 2026)
Changed paths:
M clang/lib/CodeGen/CGOpenMPRuntime.cpp
A clang/test/OpenMP/critical-dso-local.cpp
M clang/test/OpenMP/critical_codegen.cpp
M clang/test/OpenMP/critical_codegen_attr.cpp
Log Message:
-----------
[OpenMP] Mark critical region lock variables as dso_local (#201157)
OpenMP named critical regions use lock variables of the form
.gomp_critical_user_<name>.var, which are created through
CGOpenMPRuntime::getCriticalRegionLock().
These variables are created via
OpenMPIRBuilder::getOrCreateInternalVariable() and bypass the normal
CodeGenModule::setDSOLocal() path used for other Clang-generated
globals. As a result, OpenMP critical lock variables do not receive the
usual frontend dso_local inference.
Apply CodeGenModule::setDSOLocal() to critical lock variables after
creation. This matches the existing frontend
dso_local inference logic.
On ELF targets with a static relocation model, this results in direct
accesses to the lock variable instead of GOT-based accesses. For
example, x86-64 code generation changes from R_X86_64_REX_GOTPCRELX
relocations
to direct relocations for .gomp_critical_user_<name>.var, while PIC code
generation remains unchanged.
Rework of #75564.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list