[clang] [CIR] Add support for thread-local storage (TLS) (PR #168662)

via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 5 13:22:48 PST 2025


adams381 wrote:

I've addressed all the review feedback:

**Code quality improvements:**
1. ✅ Simplified GetGlobalOp usage - removed unnecessary intermediate variable and .getAddr() call
2. ✅ Fixed function name capitalization: `GetDefaultCIRTLSModel` → `getDefaultCIRTLSModel`
3. ✅ Used `cast<>` instead of `dyn_cast<>` + assert for type safety
4. ✅ Removed `auto` where type wasn't obvious (`tlm` variable)
5. ✅ Improved error messages: replaced `llvm_unreachable` with `errorNYI` for NYI features
6. ✅ Removed `const` from `setTLSMode` to allow proper error reporting

**Testing:**
7. ✅ Added `invalid-tls.cir` test to verify TLS verification logic catches malformed IR

All tests passing. Ready for another look!

https://github.com/llvm/llvm-project/pull/168662


More information about the cfe-commits mailing list