[all-commits] [llvm/llvm-project] 373889: [CIR][LoweringPrepare] Emit guard variables for st...
Bruno Cardoso Lopes via All-commits
all-commits at lists.llvm.org
Wed Feb 11 18:15:51 PST 2026
Branch: refs/heads/users/bcardosolopes/cir-static-local-lowprep
Home: https://github.com/llvm/llvm-project
Commit: 3738892c9ca2571a902505c89fa65dd6e0fd92b7
https://github.com/llvm/llvm-project/commit/3738892c9ca2571a902505c89fa65dd6e0fd92b7
Author: Bruno Cardoso Lopes <bruno.cardoso at gmail.com>
Date: 2026-02-11 (Wed, 11 Feb 2026)
Changed paths:
M clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
M clang/include/clang/CIR/Dialect/IR/CIROps.td
M clang/include/clang/CIR/Interfaces/ASTAttrInterfaces.h
M clang/include/clang/CIR/Interfaces/ASTAttrInterfaces.td
M clang/include/clang/CIR/MissingFeatures.h
M clang/lib/CIR/CodeGen/CIRGenDecl.cpp
M clang/lib/CIR/CodeGen/CIRGenDeclCXX.cpp
M clang/lib/CIR/CodeGen/CIRGenModule.cpp
M clang/lib/CIR/Dialect/IR/CIRDialect.cpp
M clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp
M clang/test/CIR/CodeGen/static-local.cpp
M clang/test/CIR/IR/invalid-static-local.cir
M clang/test/CIR/IR/static-local.cir
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