[InstCombine] Preserve NSW flags for `lshr (mul nuw X, C1), C2 -> mul nuw nsw X,...
[llvm-project.git] / clang / test / CodeGenCXX / threadsafe-statics.cpp
blob4c53482d4c4c9b84668e358baa15a10d4ae563f4
1 // RUN: %clang_cc1 -emit-llvm -triple=x86_64-apple-darwin10 -o - %s | FileCheck -check-prefix=WITH-TSS %s
2 // RUN: %clang_cc1 -emit-llvm -triple=x86_64-apple-darwin10 -o - %s -fno-threadsafe-statics | FileCheck -check-prefix=NO-TSS %s
4 int f();
6 // WITH-TSS: @_ZZ1gvE1a = internal global i32 0, align 4
7 // WITH-TSS: @_ZGVZ1gvE1a = internal global i64 0
9 // WITH-TSS: define{{.*}} void @_Z1gv() [[NUW:#[0-9]+]]
10 // WITH-TSS: call i32 @__cxa_guard_acquire
11 // WITH-TSS: call void @__cxa_guard_release
12 // WITH-TSS: ret void
13 void g() {
14 static int a = f();
17 // NO-TSS: @_ZZ1gvE1a = internal global i32 0, align 4
18 // NO-TSS: @_ZGVZ1gvE1a = internal global i8 0
20 // NO-TSS: define{{.*}} void @_Z1gv() [[NUW:#[0-9]+]]
21 // NO-TSS-NOT: call i32 @__cxa_guard_acquire
22 // NO-TSS-NOT: call void @__cxa_guard_release
23 // NO-TSS: ret void
25 // WITH-TSS: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
27 // NO-TSS: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }