-
Notifications
You must be signed in to change notification settings - Fork 752
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IRVerifier: Allow GlobalValue as llvm.threadlocal.address operand (#8…
…8321) Loosen `llvm.threadlocal.address` verifier checks to allow any `GlobalValue` with `isThreadLocal()` set to true.
- Loading branch information
Showing
4 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
; RUN: opt -passes=verify -S < %s | FileCheck %s | ||
|
||
@var = thread_local global i32 0 | ||
@alias = thread_local alias i32, ptr @var | ||
|
||
; CHECK-LABEL: @should_pass | ||
define void @should_pass() { | ||
%p0 = call ptr @llvm.threadlocal.address(ptr @var) | ||
store i32 42, ptr %p0, align 4 | ||
%p1 = call ptr @llvm.threadlocal.address(ptr @alias) | ||
store i32 13, ptr %p1, align 4 | ||
ret void | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s | ||
|
||
@var = global i32 0 | ||
@tlsvar = thread_local addrspace(1) global i32 0 | ||
|
||
define void @fail0(ptr %arg) { | ||
; CHECK: llvm.threadlocal.address first argument must be a GlobalValue | ||
%p0 = call ptr @llvm.threadlocal.address(ptr %arg) | ||
store i32 42, ptr %p0, align 4 | ||
ret void | ||
} | ||
|
||
define void @fail1() { | ||
; CHECK: llvm.threadlocal.address first argument must be a GlobalValue | ||
%p0 = call ptr @llvm.threadlocal.address.p0(ptr addrspacecast (ptr addrspace(1) @tlsvar to ptr addrspace(0))) | ||
store i32 42, ptr %p0, align 4 | ||
ret void | ||
} | ||
|
||
|
||
|
||
define void @fail2() { | ||
; CHECK: llvm.threadlocal.address operand isThreadLocal() must be true | ||
%p0 = call ptr @llvm.threadlocal.address(ptr @var) | ||
store i32 42, ptr %p0, align 4 | ||
ret void | ||
} | ||
|
||
define void @fail3() { | ||
; CHECK: llvm.threadlocal.address operand isThreadLocal() must be true | ||
%p0 = call ptr @llvm.threadlocal.address(ptr @fail2) | ||
store i32 42, ptr %p0, align 4 | ||
ret void | ||
} |