2015-11-12 06:42:31 +08:00
|
|
|
// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck --check-prefix=CHECK --check-prefix=LINUX %s
|
|
|
|
// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple x86_64-apple-darwin12 | FileCheck --check-prefix=CHECK --check-prefix=DARWIN %s
|
2013-04-20 00:42:07 +08:00
|
|
|
|
|
|
|
int &f();
|
|
|
|
|
2015-11-12 06:42:31 +08:00
|
|
|
// LINUX: @r = thread_local global i32* null
|
|
|
|
// DARWIN: @r = internal thread_local global i32* null
|
2013-04-20 00:42:07 +08:00
|
|
|
thread_local int &r = f();
|
|
|
|
|
2015-11-12 06:42:31 +08:00
|
|
|
// LINUX: @_ZTH1r = alias void (), void ()* @__tls_init
|
|
|
|
// DARWIN: @_ZTH1r = internal alias void (), void ()* @__tls_init
|
2013-04-20 00:42:07 +08:00
|
|
|
|
|
|
|
int &g() { return r; }
|
|
|
|
|
|
|
|
// CHECK: define {{.*}} @[[R_INIT:.*]]()
|
2014-07-18 23:52:10 +08:00
|
|
|
// CHECK: call dereferenceable({{[0-9]+}}) i32* @_Z1fv()
|
2013-04-20 00:42:07 +08:00
|
|
|
// CHECK: store i32* %{{.*}}, i32** @r, align 8
|
|
|
|
|
2014-07-18 23:52:10 +08:00
|
|
|
// CHECK-LABEL: define dereferenceable({{[0-9]+}}) i32* @_Z1gv()
|
2015-12-17 08:42:36 +08:00
|
|
|
// LINUX: call i32* @_ZTW1r()
|
|
|
|
// DARWIN: call cxx_fast_tlscc i32* @_ZTW1r()
|
2013-04-20 00:42:07 +08:00
|
|
|
// CHECK: ret i32* %{{.*}}
|
|
|
|
|
2016-01-15 11:34:06 +08:00
|
|
|
// LINUX: define weak_odr hidden i32* @_ZTW1r() [[ATTR0:#[0-9]+]] {
|
|
|
|
// DARWIN: define cxx_fast_tlscc i32* @_ZTW1r() [[ATTR1:#[0-9]+]] {
|
2013-04-20 00:42:07 +08:00
|
|
|
// CHECK: call void @_ZTH1r()
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: load i32*, i32** @r, align 8
|
2013-04-20 00:42:07 +08:00
|
|
|
// CHECK: ret i32* %{{.*}}
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define internal void @__tls_init()
|
2013-04-20 00:42:07 +08:00
|
|
|
// CHECK: call void @[[R_INIT]]()
|
2015-12-17 08:42:36 +08:00
|
|
|
|
2016-01-15 11:34:06 +08:00
|
|
|
// LINUX: attributes [[ATTR0]] = { {{.*}}"target-features"{{.*}} }
|
|
|
|
// DARWIN: attributes [[ATTR1]] = { {{.*}}nounwind{{.*}}"target-features"{{.*}} }
|