[clang] [CIR] Add support for thread-local storage (TLS) (PR #168662)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 3 13:49:38 PST 2025
================
@@ -1672,7 +1527,10 @@ cir::GetGlobalOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
if (auto g = dyn_cast<GlobalOp>(op)) {
symTy = g.getSymType();
assert(!cir::MissingFeatures::addressSpace());
- assert(!cir::MissingFeatures::opGlobalThreadLocal());
+ // Verify that for thread local global access, the global needs to
+ // be marked with tls bits.
+ if (getTls() && !g.getTlsModel())
+ return emitOpError("access to global not marked thread local");
----------------
andykaylor wrote:
Can you create an invalid CIR test to test this? You can use `clang/test/CIR/IR/invalid-func-attr.cir` as an example to base your new test on.
https://github.com/llvm/llvm-project/pull/168662
More information about the cfe-commits
mailing list