llvm-project/llvm/test/Assembler/autoupgrade-thread-pointer.ll
Jessica Clarke 864f0ff4ef
[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.
2025-05-14 21:51:56 +01:00

20 lines
515 B
LLVM

; Test autoupgrade of arch-specific thread pointer intrinsics
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
declare ptr @llvm.aarch64.thread.pointer()
declare ptr @llvm.arm.thread.pointer()
define ptr @test1() {
; CHECK-LABEL: define ptr @test1()
; CHECK: call ptr @llvm.thread.pointer.p0()
%1 = call ptr @llvm.aarch64.thread.pointer()
ret ptr %1
}
define ptr @test2() {
; CHECK-LABEL: define ptr @test2()
; CHECK: call ptr @llvm.thread.pointer.p0()
%1 = call ptr @llvm.arm.thread.pointer()
ret ptr %1
}