// RUN: %clang_cc1 -no-opaque-pointers -emit-llvm -std=c++1z %s -o - -triple=x86_64-linux-gnu | FileCheck %s
;
// CHECK-LABEL: define {{.*}}global_var_init
// CHECK-NOT: br
// CHECK: call void @_ZN1SC1Ev({{.*}}* {{[^,]*}} @global)
S global;
// CHECK-LABEL: define {{.*}}global_var_init
// FIXME: Do we really need thread-safe initialization here? We don't run
// global ctors on multiple threads. (If we were to do so, we'd need thread-safe
// init for B<int>::member and B<int>::inline_member too.)
// CHECK: load atomic i8, i8* bitcast (i64* @_ZGV13inline_global to i8*) acquire, align 8
// CHECK: icmp eq i8 {{.*}}, 0
// CHECK: br i1
// CHECK-NOT: !prof
// CHECK: call void @_ZN1SC1Ev({{.*}}* {{[^,]*}} @inline_global)
inline S inline_global;
// CHECK-LABEL: define {{.*}}global_var_init
// CHECK-NOT: br
// CHECK: call void @_ZN1SC1Ev({{.*}}* {{[^,]*}} @thread_local_global)
thread_local S thread_local_global;
// CHECK-LABEL: define {{.*}}global_var_init
// CHECK: load i8, i8* bitcast (i64* @_ZGV26thread_local_inline_global to i8*)
// CHECK: icmp eq i8 {{.*}}, 0
// CHECK: br i1
// CHECK-NOT: !prof
// CHECK: call void @_ZN1SC1Ev({{.*}}* {{[^,]*}} @thread_local_inline_global)
thread_local inline S thread_local_inline_global;
;
// CHECK-LABEL: define{{.*}} void @_Z1fv()
void
// CHECK-LABEL: define {{.*}}global_var_init
// CHECK-NOT: br
// CHECK: call void @_ZN1SC1Ev({{.*}}* {{[^,]*}} @_ZN1A6memberE)
S A::member;
// CHECK-LABEL: define {{.*}}global_var_init
// CHECK-NOT: br
// CHECK: call void @_ZN1SC1Ev({{.*}}* {{[^,]*}} @_ZN1A19thread_local_memberE)
thread_local S A::thread_local_member;
;
S B<T>::member;
thread_local S B<T>::thread_local_member;
void ;
void
// CHECK-LABEL: define {{.*}}tls_init()
// CHECK: load i8, i8* @__tls_guard, align 1
// CHECK: icmp eq i8 {{.*}}, 0
// CHECK: br i1 {{.*}}, !prof ![[WEIGHTS_THREAD_LOCAL]]
// CHECK-DAG: ![[WEIGHTS_THREAD_LOCAL]] = !{!"branch_weights", i32 1, i32 1023}
// CHECK-DAG: ![[WEIGHTS_LOCAL]] = !{!"branch_weights", i32 1, i32 1048575}