[clang] [Clang] Access tls_guard via llvm.threadlocal.address (PR #96633)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 26 06:47:41 PDT 2024


================
@@ -1059,9 +1059,15 @@ CodeGenFunction::GenerateCXXGlobalInitFunc(llvm::Function *Fn,
     if (Guard.isValid()) {
       // If we have a guard variable, check whether we've already performed
       // these initializations. This happens for TLS initialization functions.
-      llvm::Value *GuardVal = Builder.CreateLoad(Guard);
-      llvm::Value *Uninit = Builder.CreateIsNull(GuardVal,
-                                                 "guard.uninitialized");
+      Address GuardAddr = Guard;
----------------
ChuanqiXu9 wrote:

It looks like the change can be simpler if we don't introduce new the  variable `GuardAddr`, is it?

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


More information about the cfe-commits mailing list