Skip to content

Commit 7a4fab4

Browse files
authored
[LoongArch] Emit error messages when using emulated TLS
Reviewed By: SixWeining Pull Request: #92483
1 parent ea6577a commit 7a4fab4

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,10 @@ LoongArchTargetLowering::lowerGlobalTLSAddress(SDValue Op,
945945
GlobalAddressSDNode *N = cast<GlobalAddressSDNode>(Op);
946946
assert(N->getOffset() == 0 && "unexpected offset in global node");
947947

948+
if (DAG.getTarget().useEmulatedTLS())
949+
report_fatal_error("the emulated TLS is prohibited",
950+
/*GenCrashDiag=*/false);
951+
948952
bool IsDesc = DAG.getTarget().useTLSDESC();
949953

950954
switch (getTargetMachine().getTLSModel(N->getGlobal())) {

llvm/test/CodeGen/LoongArch/emutls.ll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
; RUN: not llc --mtriple=loongarch64 -emulated-tls -mattr=+d \
2+
; RUN: -relocation-model=pic < %s 2>&1 | FileCheck %s
3+
4+
; CHECK: LLVM ERROR: the emulated TLS is prohibited
5+
6+
@x = thread_local global i8 7, align 2
7+
8+
define ptr @get_x() nounwind {
9+
entry:
10+
ret ptr @x
11+
}

0 commit comments

Comments
 (0)