[llvm] IRVerifier: Allow GlobalValue as llvm.threadlocal.address operand (PR #88321)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 10 14:28:49 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-ir

Author: Matthias Braun (MatzeB)

<details>
<summary>Changes</summary>

Loosen `llvm.threadlocal.address` verifier checks to allow any `GlobalValue` with `isThreadLocal()` set to true.

---
Full diff: https://github.com/llvm/llvm-project/pull/88321.diff


2 Files Affected:

- (modified) llvm/docs/LangRef.rst (+2-1) 
- (modified) llvm/lib/IR/Verifier.cpp (+4-4) 


``````````diff
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index f6ada292b93b10..9592929d79feb4 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -28130,7 +28130,8 @@ Syntax:
 Arguments:
 """"""""""
 
-The first argument is a thread local :ref:`global variable <globalvars>`.
+The `llvm.threadlocal.address` intrinsic requires a global value argument (a
+:ref:`global variable <globalvars>` or alias) that is thread local.
 
 Semantics:
 """"""""""
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 4092f0cb12ffe9..25cb99f0f9bd8b 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -6226,10 +6226,10 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
   }
   case Intrinsic::threadlocal_address: {
     const Value &Arg0 = *Call.getArgOperand(0);
-    Check(isa<GlobalVariable>(Arg0),
-          "llvm.threadlocal.address first argument must be a GlobalVariable");
-    Check(cast<GlobalVariable>(Arg0).isThreadLocal(),
-          "llvm.threadlocal.address operand isThreadLocal() must no be false");
+    Check(isa<GlobalValue>(Arg0),
+          "llvm.threadlocal.address first argument must be a GlobalValue");
+    Check(cast<GlobalValue>(Arg0).isThreadLocal(),
+          "llvm.threadlocal.address operand isThreadLocal() must be true");
     break;
   }
   };

``````````

</details>


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


More information about the llvm-commits mailing list