[all-commits] [llvm/llvm-project] 2d84c7: [CIR][LoweringPrepare] Emit guard variables for st...
Bruno Cardoso Lopes via All-commits
all-commits at lists.llvm.org
Tue Feb 10 23:01:25 PST 2026
Branch: refs/heads/users/bcardosolopes/cir-static-local-lowprep
Home: https://github.com/llvm/llvm-project
Commit: 2d84c7716453b8dffb848f85823727b04dd125e4
https://github.com/llvm/llvm-project/commit/2d84c7716453b8dffb848f85823727b04dd125e4
Author: Bruno Cardoso Lopes <bruno.cardoso at gmail.com>
Date: 2026-01-30 (Fri, 30 Jan 2026)
Changed paths:
M clang/include/clang/CIR/MissingFeatures.h
M clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp
M clang/test/CIR/CodeGen/static-local.cpp
Log Message:
-----------
[CIR][LoweringPrepare] Emit guard variables for static local initialization
This implements the lowering of static local variables with the Itanium C++ ABI
guard variable pattern in LoweringPrepare.
When a GlobalOp has the static_local attribute and a ctor region, this pass:
1. Creates a guard variable global (mangled name from AST)
2. Inserts the guard check pattern at each GetGlobalOp use site:
- Load guard byte with acquire ordering
- If zero, call __cxa_guard_acquire
- If acquire returns non-zero, inline the ctor region code
- Call __cxa_guard_release
3. Clears the static_local attribute and ctor region from the GlobalOp
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