[InstCombine] Preserve NSW flags for `lshr (mul nuw X, C1), C2 -> mul nuw nsw X,...
[llvm-project.git] / clang / test / CodeGenCXX / goto.cpp
blob8a1e24ad7e5afa47396de76c4ea6b799f16f0c72
1 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fcxx-exceptions -fexceptions -emit-llvm -std=c++98 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s
2 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fcxx-exceptions -fexceptions -emit-llvm -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s
4 // Reduced from a crash on boost::interprocess's node_allocator_test.cpp.
5 namespace test0 {
6 struct A { A(); ~A(); };
7 struct V { V(const A &a = A()); ~V(); };
9 // CHECK-LABEL: define linkonce_odr noundef i32 @_ZN5test04testILi0EEEii
10 template<int X> int test(int x) {
11 // CHECK: [[RET:%.*]] = alloca i32
12 // CHECK-NEXT: [[X:%.*]] = alloca i32
13 // CHECK-NEXT: [[Y:%.*]] = alloca [[A:%.*]],
14 // CHECK-NEXT: [[Z:%.*]] = alloca [[A]]
15 // CHECK-NEXT: [[EXN:%.*]] = alloca ptr
16 // CHECK-NEXT: [[SEL:%.*]] = alloca i32
17 // CHECK-NEXT: [[V:%.*]] = alloca ptr,
18 // CHECK-NEXT: [[TMP:%.*]] = alloca [[A]]
19 // CHECK-NEXT: [[CLEANUPACTIVE:%.*]] = alloca i1
20 // CHECK: call void @_ZN5test01AC1Ev(ptr {{[^,]*}} [[Y]])
21 // CHECK-NEXT: invoke void @_ZN5test01AC1Ev(ptr {{[^,]*}} [[Z]])
22 // CHECK: [[NEW:%.*]] = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 1)
23 // CHECK: store i1 true, ptr [[CLEANUPACTIVE]]
24 // CHECK-NEXT: invoke void @_ZN5test01AC1Ev(ptr {{[^,]*}} [[TMP]])
25 // CHECK: invoke void @_ZN5test01VC1ERKNS_1AE(ptr {{[^,]*}} [[NEW]], ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[TMP]])
26 // CHECK: store i1 false, ptr [[CLEANUPACTIVE]]
28 // CHECK98-NEXT: invoke void @_ZN5test01AD1Ev(ptr {{[^,]*}} [[TMP]])
29 // CHECK11-NEXT: call void @_ZN5test01AD1Ev(ptr {{[^,]*}} [[TMP]])
30 A y;
31 try {
32 A z;
33 V *v = new V();
35 if (x) return 1;
36 } catch (int ex) {
37 return 1;
39 return 0;
42 int test() {
43 return test<0>(5);