summaryrefslogtreecommitdiff
path: root/clang/test/CodeGenCXX/ms-thread_local.cpp
diff options
context:
space:
mode:
authorJun Ma <JunMa@linux.alibaba.com>2020-06-16 14:30:36 +0800
committerJun Ma <JunMa@linux.alibaba.com>2020-06-17 08:31:13 +0800
commit4a1776979fd8e9473e433d7ec6f2bbf4bf9523ff (patch)
treed4b9b40504fab9d042cac064d47ff81576690918 /clang/test/CodeGenCXX/ms-thread_local.cpp
parent0a5228a02c32cb5b10d43cb154d6d0abaf360ba7 (diff)
[CodeGen][TLS] Set TLS Model for __tls_guard as well.
Differential Revision: https://reviews.llvm.org/D81543
Diffstat (limited to 'clang/test/CodeGenCXX/ms-thread_local.cpp')
-rw-r--r--clang/test/CodeGenCXX/ms-thread_local.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/ms-thread_local.cpp b/clang/test/CodeGenCXX/ms-thread_local.cpp
index 76eba52b1634..3341e4f57388 100644
--- a/clang/test/CodeGenCXX/ms-thread_local.cpp
+++ b/clang/test/CodeGenCXX/ms-thread_local.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -std=c++1y -triple=i686-pc-win32 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -std=c++1y -triple=i686-pc-win32 -ftls-model=local-dynamic -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-LD
struct A {
A();
@@ -8,15 +9,22 @@ struct A {
// CHECK-DAG: $"??$a@X@@3UA@@A" = comdat any
// CHECK-DAG: @"??$a@X@@3UA@@A" = linkonce_odr dso_local thread_local global %struct.A zeroinitializer, comdat, align 1
// CHECK-DAG: @"??__E?$a@X@@YAXXZ$initializer$" = internal constant void ()* @"??__E?$a@X@@YAXXZ", section ".CRT$XDU", comdat($"??$a@X@@3UA@@A")
+// CHECK-LD-DAG: $"??$a@X@@3UA@@A" = comdat any
+// CHECK-LD-DAG: @"??$a@X@@3UA@@A" = linkonce_odr dso_local thread_local(localdynamic) global %struct.A zeroinitializer, comdat, align 1
+// CHECK-LD-DAG: @"??__E?$a@X@@YAXXZ$initializer$" = internal constant void ()* @"??__E?$a@X@@YAXXZ", section ".CRT$XDU", comdat($"??$a@X@@3UA@@A")
template <typename T>
thread_local A a = A();
// CHECK-DAG: @"?b@@3UA@@A" = dso_local thread_local global %struct.A zeroinitializer, align 1
// CHECK-DAG: @"__tls_init$initializer$" = internal constant void ()* @__tls_init, section ".CRT$XDU"
+// CHECK-LD-DAG: @"?b@@3UA@@A" = dso_local thread_local(localdynamic) global %struct.A zeroinitializer, align 1
+// CHECK-LD-DAG: @"__tls_init$initializer$" = internal constant void ()* @__tls_init, section ".CRT$XDU"
thread_local A b;
// CHECK-LABEL: define internal void @__tls_init()
// CHECK: call void @"??__Eb@@YAXXZ"
+// CHECK-LD-LABEL: define internal void @__tls_init()
+// CHECK-LD: call void @"??__Eb@@YAXXZ"
thread_local A &c = b;
thread_local A &d = c;
@@ -29,3 +37,5 @@ A f() {
// CHECK: !llvm.linker.options = !{![[dyn_tls_init:[0-9]+]]}
// CHECK: ![[dyn_tls_init]] = !{!"/include:___dyn_tls_init@12"}
+// CHECK-LD: !llvm.linker.options = !{![[dyn_tls_init:[0-9]+]]}
+// CHECK-LD: ![[dyn_tls_init]] = !{!"/include:___dyn_tls_init@12"}