aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorJessica Clarke <jrtc27@jrtc27.com>2025-05-14 21:51:56 +0100
committerGitHub <noreply@github.com>2025-05-14 21:51:56 +0100
commit864f0ff4efc220609764a3075c289b395dc9b907 (patch)
treeaaef12f61e23f9431d3ab1e672cf027eb8af6154 /llvm/lib/IR/Verifier.cpp
parent0ab67ec191673a148d84f3819f5c97aaa5b84364 (diff)
downloadllvm-864f0ff4efc220609764a3075c289b395dc9b907.zip
llvm-864f0ff4efc220609764a3075c289b395dc9b907.tar.gz
llvm-864f0ff4efc220609764a3075c289b395dc9b907.tar.bz2
[clang][IR] Overload @llvm.thread.pointer to support non-AS0 targets (#132489)
Thread-local globals live, by default, in the default globals address space, which may not be 0, so we need to overload @llvm.thread.pointer to support other address spaces, and use the default globals address space in Clang.
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 7979e19..73b4274 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -6553,6 +6553,14 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
&Call);
break;
}
+ case Intrinsic::thread_pointer: {
+ Check(Call.getType()->getPointerAddressSpace() ==
+ DL.getDefaultGlobalsAddressSpace(),
+ "llvm.thread.pointer intrinsic return type must be for the globals "
+ "address space",
+ &Call);
+ break;
+ }
case Intrinsic::threadlocal_address: {
const Value &Arg0 = *Call.getArgOperand(0);
Check(isa<GlobalValue>(Arg0),