1044cc54a7d83c90857187c4cd4a0fd33664a7f7fJohn McCall// RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm -fexceptions %s -o - |FileCheck %s 2931a4feb64f18190d189c222d61b2abf52f18ab8Tim Northover// RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm %s -o - |FileCheck -check-prefix CHECK-NOEXC %s 3b6d6993e6e6d3daf4d9876794254d20a134e37c2Pirama Arumuga Nainar// RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm \ 4b6d6993e6e6d3daf4d9876794254d20a134e37c2Pirama Arumuga Nainar// RUN: -momit-leaf-frame-pointer -mdisable-fp-elim %s -o - \ 5b6d6993e6e6d3daf4d9876794254d20a134e37c2Pirama Arumuga Nainar// RUN: | FileCheck -check-prefix CHECK-FP %s 689ed31d3f9eeb8ec77c284a5cf404a74bf5e7acfAnders Carlsson 789ed31d3f9eeb8ec77c284a5cf404a74bf5e7acfAnders Carlssonstruct A { 889ed31d3f9eeb8ec77c284a5cf404a74bf5e7acfAnders Carlsson A(); 989ed31d3f9eeb8ec77c284a5cf404a74bf5e7acfAnders Carlsson ~A(); 1089ed31d3f9eeb8ec77c284a5cf404a74bf5e7acfAnders Carlsson}; 1189ed31d3f9eeb8ec77c284a5cf404a74bf5e7acfAnders Carlsson 1274d644abe56809d9bcea7311f37aa9063ab9e064Anders Carlssonstruct B { B(); ~B(); }; 1374d644abe56809d9bcea7311f37aa9063ab9e064Anders Carlsson 14fb8b69aef3377aaa786d1278aaae7e7b04ac095fJohn McCallstruct C { void *field; }; 15fb8b69aef3377aaa786d1278aaae7e7b04ac095fJohn McCall 162ca4f633b21c65e1a4edc2405a768d7f5db564ebAnders Carlssonstruct D { ~D(); }; 172ca4f633b21c65e1a4edc2405a768d7f5db564ebAnders Carlsson 186bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines// CHECK: @__dso_handle = external global i8 19fb8b69aef3377aaa786d1278aaae7e7b04ac095fJohn McCall// CHECK: @c = global %struct.C zeroinitializer, align 8 20fb8b69aef3377aaa786d1278aaae7e7b04ac095fJohn McCall 216d311229f0b894f6a8acda2d78f06a4198b487b7John McCall// It's okay if we ever implement the IR-generation optimization to remove this. 223ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar// CHECK: @_ZN5test3L3varE = internal constant i8* getelementptr inbounds ([7 x i8], [7 x i8]* 236d311229f0b894f6a8acda2d78f06a4198b487b7John McCall 245c5a764fcd256df6f6cfbce5cdd2a2dfb2c45e95Anders Carlsson// PR6205: The casts should not require global initializers 255c5a764fcd256df6f6cfbce5cdd2a2dfb2c45e95Anders Carlsson// CHECK: @_ZN6PR59741cE = external global %"struct.PR5974::C" 263ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar// CHECK: @_ZN6PR59741aE = global %"struct.PR5974::A"* getelementptr inbounds (%"struct.PR5974::C", %"struct.PR5974::C"* @_ZN6PR59741cE, i32 0, i32 0) 273ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar// CHECK: @_ZN6PR59741bE = global %"struct.PR5974::B"* bitcast (i8* getelementptr (i8, i8* bitcast (%"struct.PR5974::C"* @_ZN6PR59741cE to i8*), i64 4) to %"struct.PR5974::B"*), align 8 285c5a764fcd256df6f6cfbce5cdd2a2dfb2c45e95Anders Carlsson 2974d644abe56809d9bcea7311f37aa9063ab9e064Anders Carlsson// CHECK: call void @_ZN1AC1Ev(%struct.A* @a) 303ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar// CHECK: call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.A*)* @_ZN1AD1Ev to void (i8*)*), i8* getelementptr inbounds (%struct.A, %struct.A* @a, i32 0, i32 0), i8* @__dso_handle) 3189ed31d3f9eeb8ec77c284a5cf404a74bf5e7acfAnders CarlssonA a; 3274d644abe56809d9bcea7311f37aa9063ab9e064Anders Carlsson 339cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner// CHECK: call void @_ZN1BC1Ev(%struct.B* @b) 343ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar// CHECK: call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.B*)* @_ZN1BD1Ev to void (i8*)*), i8* getelementptr inbounds (%struct.B, %struct.B* @b, i32 0, i32 0), i8* @__dso_handle) 3574d644abe56809d9bcea7311f37aa9063ab9e064Anders CarlssonB b; 36fb8b69aef3377aaa786d1278aaae7e7b04ac095fJohn McCall 37fb8b69aef3377aaa786d1278aaae7e7b04ac095fJohn McCall// PR6205: this should not require a global initializer 38fb8b69aef3377aaa786d1278aaae7e7b04ac095fJohn McCall// CHECK-NOT: call void @_ZN1CC1Ev(%struct.C* @c) 39fb8b69aef3377aaa786d1278aaae7e7b04ac095fJohn McCallC c; 40fb8b69aef3377aaa786d1278aaae7e7b04ac095fJohn McCall 413ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar// CHECK: call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.D*)* @_ZN1DD1Ev to void (i8*)*), i8* getelementptr inbounds (%struct.D, %struct.D* @d, i32 0, i32 0), i8* @__dso_handle) 422ca4f633b21c65e1a4edc2405a768d7f5db564ebAnders CarlssonD d; 432ca4f633b21c65e1a4edc2405a768d7f5db564ebAnders Carlsson 44bf40cb518312dde1c07e44fcae59bc4eec65589cJohn McCall// <rdar://problem/7458115> 45bf40cb518312dde1c07e44fcae59bc4eec65589cJohn McCallnamespace test1 { 46bf40cb518312dde1c07e44fcae59bc4eec65589cJohn McCall int f(); 47bf40cb518312dde1c07e44fcae59bc4eec65589cJohn McCall const int x = f(); // This has side-effects and gets emitted immediately. 48bf40cb518312dde1c07e44fcae59bc4eec65589cJohn McCall const int y = x - 1; // This gets deferred. 49bf40cb518312dde1c07e44fcae59bc4eec65589cJohn McCall const int z = ~y; // This also gets deferred, but gets "undeferred" before y. 50bf40cb518312dde1c07e44fcae59bc4eec65589cJohn McCall int test() { return z; } 5193ab6bf534fb6c26563c00f28a8fc5581bb71dfdStephen Lin// CHECK-LABEL: define i32 @_ZN5test14testEv() 5285aca0f6a9da02bda705690fd56d0aa713604f08John McCall 5385aca0f6a9da02bda705690fd56d0aa713604f08John McCall // All of these initializers end up delayed, so we check them later. 5485aca0f6a9da02bda705690fd56d0aa713604f08John McCall} 5585aca0f6a9da02bda705690fd56d0aa713604f08John McCall 5685aca0f6a9da02bda705690fd56d0aa713604f08John McCall// <rdar://problem/8246444> 5785aca0f6a9da02bda705690fd56d0aa713604f08John McCallnamespace test2 { 5885aca0f6a9da02bda705690fd56d0aa713604f08John McCall struct allocator { allocator(); ~allocator(); }; 5985aca0f6a9da02bda705690fd56d0aa713604f08John McCall struct A { A(const allocator &a = allocator()); ~A(); }; 6085aca0f6a9da02bda705690fd56d0aa713604f08John McCall 6185aca0f6a9da02bda705690fd56d0aa713604f08John McCall A a; 6285aca0f6a9da02bda705690fd56d0aa713604f08John McCall// CHECK: call void @_ZN5test29allocatorC1Ev( 6385aca0f6a9da02bda705690fd56d0aa713604f08John McCall// CHECK: invoke void @_ZN5test21AC1ERKNS_9allocatorE( 6485aca0f6a9da02bda705690fd56d0aa713604f08John McCall// CHECK: call void @_ZN5test29allocatorD1Ev( 6585aca0f6a9da02bda705690fd56d0aa713604f08John McCall// CHECK: call i32 @__cxa_atexit({{.*}} @_ZN5test21AD1Ev {{.*}} @_ZN5test21aE 6685aca0f6a9da02bda705690fd56d0aa713604f08John McCall} 6785aca0f6a9da02bda705690fd56d0aa713604f08John McCall 686d311229f0b894f6a8acda2d78f06a4198b487b7John McCallnamespace test3 { 696d311229f0b894f6a8acda2d78f06a4198b487b7John McCall // Tested at the beginning of the file. 706d311229f0b894f6a8acda2d78f06a4198b487b7John McCall const char * const var = "string"; 716d311229f0b894f6a8acda2d78f06a4198b487b7John McCall extern const char * const var; 726d311229f0b894f6a8acda2d78f06a4198b487b7John McCall 736d311229f0b894f6a8acda2d78f06a4198b487b7John McCall const char *test() { return var; } 746d311229f0b894f6a8acda2d78f06a4198b487b7John McCall} 756d311229f0b894f6a8acda2d78f06a4198b487b7John McCall 768ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smithnamespace test4 { 77e67d1512f299e7f32182553f9941d61dae4f433eDouglas Gregor struct A { 78e67d1512f299e7f32182553f9941d61dae4f433eDouglas Gregor A(); 79e67d1512f299e7f32182553f9941d61dae4f433eDouglas Gregor }; 80e67d1512f299e7f32182553f9941d61dae4f433eDouglas Gregor extern int foo(); 81e67d1512f299e7f32182553f9941d61dae4f433eDouglas Gregor 82e67d1512f299e7f32182553f9941d61dae4f433eDouglas Gregor // This needs an initialization function and guard variables. 833ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar // CHECK: load i8, i8* bitcast (i64* @_ZGVN5test41xE 848ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK: [[CALL:%.*]] = call i32 @_ZN5test43fooEv 858ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK-NEXT: store i32 [[CALL]], i32* @_ZN5test41xE 868ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK-NEXT: store i64 1, i64* @_ZGVN5test41xE 87e67d1512f299e7f32182553f9941d61dae4f433eDouglas Gregor __attribute__((weak)) int x = foo(); 88e67d1512f299e7f32182553f9941d61dae4f433eDouglas Gregor} 89e67d1512f299e7f32182553f9941d61dae4f433eDouglas Gregor 905c5a764fcd256df6f6cfbce5cdd2a2dfb2c45e95Anders Carlssonnamespace PR5974 { 915c5a764fcd256df6f6cfbce5cdd2a2dfb2c45e95Anders Carlsson struct A { int a; }; 925c5a764fcd256df6f6cfbce5cdd2a2dfb2c45e95Anders Carlsson struct B { int b; }; 935c5a764fcd256df6f6cfbce5cdd2a2dfb2c45e95Anders Carlsson struct C : A, B { int c; }; 945c5a764fcd256df6f6cfbce5cdd2a2dfb2c45e95Anders Carlsson 955c5a764fcd256df6f6cfbce5cdd2a2dfb2c45e95Anders Carlsson extern C c; 965c5a764fcd256df6f6cfbce5cdd2a2dfb2c45e95Anders Carlsson 975c5a764fcd256df6f6cfbce5cdd2a2dfb2c45e95Anders Carlsson // These should not require global initializers. 985c5a764fcd256df6f6cfbce5cdd2a2dfb2c45e95Anders Carlsson A* a = &c; 995c5a764fcd256df6f6cfbce5cdd2a2dfb2c45e95Anders Carlsson B* b = &c; 1005c5a764fcd256df6f6cfbce5cdd2a2dfb2c45e95Anders Carlsson} 101bf40cb518312dde1c07e44fcae59bc4eec65589cJohn McCall 10226fbc72b33bdbd20b0145bf117c64d373f8051e3John McCall// PR9570: the indirect field shouldn't crash IR gen. 10326fbc72b33bdbd20b0145bf117c64d373f8051e3John McCallnamespace test5 { 1041d1a679090afe8468c6c95f8ab9c3192683ac69fJohn McCall static union { 10526fbc72b33bdbd20b0145bf117c64d373f8051e3John McCall unsigned bar[4096] __attribute__((aligned(128))); 10626fbc72b33bdbd20b0145bf117c64d373f8051e3John McCall }; 10726fbc72b33bdbd20b0145bf117c64d373f8051e3John McCall} 10826fbc72b33bdbd20b0145bf117c64d373f8051e3John McCall 1098ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smithnamespace std { struct type_info; } 1108ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith 1118ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smithnamespace test6 { 1128ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith struct A { virtual ~A(); }; 1138ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith struct B : A {}; 1148ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith extern A *p; 1158ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith 1168ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // We must emit a dynamic initializer for 'q', because it could throw. 1178ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith B *const q = &dynamic_cast<B&>(*p); 1188ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK: call void @__cxa_bad_cast() 1198ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK: store {{.*}} @_ZN5test6L1qE 1208ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith 1218ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // We don't need to emit 'r' at all, because it has internal linkage, is 1228ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // unused, and its initialization has no side-effects. 1238ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith B *const r = dynamic_cast<B*>(p); 1248ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK-NOT: call void @__cxa_bad_cast() 1258ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK-NOT: store {{.*}} @_ZN5test6L1rE 1268ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith 1278ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // This can throw, so we need to emit it. 1288ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith const std::type_info *const s = &typeid(*p); 1298ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK: store {{.*}} @_ZN5test6L1sE 1308ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith 1318ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // This can't throw, so we don't. 1328ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith const std::type_info *const t = &typeid(p); 1338ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK-NOT: @_ZN5test6L1tE 1348ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith 13560b70388e43d146d968a1cc0705b30cb2d7263feRichard Smith extern B *volatile v; 13660b70388e43d146d968a1cc0705b30cb2d7263feRichard Smith // CHECK: store {{.*}} @_ZN5test6L1wE 13760b70388e43d146d968a1cc0705b30cb2d7263feRichard Smith B *const w = dynamic_cast<B*>(v); 13860b70388e43d146d968a1cc0705b30cb2d7263feRichard Smith 13960b70388e43d146d968a1cc0705b30cb2d7263feRichard Smith // CHECK: load volatile 14060b70388e43d146d968a1cc0705b30cb2d7263feRichard Smith // CHECK: store {{.*}} @_ZN5test6L1xE 14160b70388e43d146d968a1cc0705b30cb2d7263feRichard Smith const int x = *(volatile int*)0x1234; 14260b70388e43d146d968a1cc0705b30cb2d7263feRichard Smith 1438ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith namespace { 1448ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith int a = int(); 1458ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith volatile int b = int(); 1468ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith int c = a; 1478ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith int d = b; 1488ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK-NOT: store {{.*}} @_ZN5test6{{[A-Za-z0-9_]*}}1aE 1498ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK-NOT: store {{.*}} @_ZN5test6{{[A-Za-z0-9_]*}}1bE 1508ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK-NOT: store {{.*}} @_ZN5test6{{[A-Za-z0-9_]*}}1cE 1518ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK: load volatile {{.*}} @_ZN5test6{{[A-Za-z0-9_]*}}1bE 1528ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK: store {{.*}} @_ZN5test6{{[A-Za-z0-9_]*}}1dE 1538ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith } 1548ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith} 1558ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith 1568ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smithnamespace test7 { 1578ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith struct A { A(); }; 1588ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith struct B { ~B(); int n; }; 15960b70388e43d146d968a1cc0705b30cb2d7263feRichard Smith struct C { C() = default; C(const C&); int n; }; 1608ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith struct D {}; 1618ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith 1628ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK: call void @_ZN5test71AC1Ev({{.*}}@_ZN5test7L1aE) 1638ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith const A a = A(); 1648ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith 1658ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK: call i32 @__cxa_atexit({{.*}} @_ZN5test71BD1Ev{{.*}} @_ZN5test7L2b1E 1668ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK: call i32 @__cxa_atexit({{.*}} @_ZN5test71BD1Ev{{.*}} @_ZGRN5test72b2E 1678ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK: call void @_ZN5test71BD1Ev( 1688ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK: store {{.*}} @_ZN5test7L2b3E 1698ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith const B b1 = B(); 1708ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith const B &b2 = B(); 1718ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith const int b3 = B().n; 1728ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith 1738ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK-NOT: @_ZN5test7L2c1E 1748ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK: @_ZN5test7L2c2E 17560b70388e43d146d968a1cc0705b30cb2d7263feRichard Smith // CHECK-NOT: @_ZN5test7L2c3E 17660b70388e43d146d968a1cc0705b30cb2d7263feRichard Smith // CHECK: @_ZN5test7L2c4E 17760b70388e43d146d968a1cc0705b30cb2d7263feRichard Smith const C c1 = C(); 17860b70388e43d146d968a1cc0705b30cb2d7263feRichard Smith const C c2 = static_cast<const C&>(C()); 17960b70388e43d146d968a1cc0705b30cb2d7263feRichard Smith const int c3 = C().n; 18060b70388e43d146d968a1cc0705b30cb2d7263feRichard Smith const int c4 = C(C()).n; 1818ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith 1828ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK-NOT: @_ZN5test7L1dE 1838ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith const D d = D(); 1848ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith 1858ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith // CHECK: store {{.*}} @_ZN5test71eE 1868ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith int f(), e = f(); 1878ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith} 1888ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith 18999ace16bc6962f1fc3dc45bbbdf2eb74e555a8adJohn McCall 19085aca0f6a9da02bda705690fd56d0aa713604f08John McCall// At the end of the file, we check that y is initialized before z. 191bf40cb518312dde1c07e44fcae59bc4eec65589cJohn McCall 1928ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith// CHECK: define internal void [[TEST1_Z_INIT:@.*]]() 1933ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar// CHECK: load i32, i32* @_ZN5test1L1yE 1948ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith// CHECK-NEXT: xor 1958ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith// CHECK-NEXT: store i32 {{.*}}, i32* @_ZN5test1L1zE 1968ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith// CHECK: define internal void [[TEST1_Y_INIT:@.*]]() 1973ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar// CHECK: load i32, i32* @_ZN5test1L1xE 1988ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith// CHECK-NEXT: sub 1998ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith// CHECK-NEXT: store i32 {{.*}}, i32* @_ZN5test1L1yE 2008ae4ec28451a16a57718286da3e476fc2f495c3fRichard Smith 201b6d6993e6e6d3daf4d9876794254d20a134e37c2Pirama Arumuga Nainar// CHECK: define internal void @_GLOBAL__sub_I_global_init.cpp() #{{[0-9]+}} section "__TEXT,__StaticInit,regular,pure_instructions" { 202bf40cb518312dde1c07e44fcae59bc4eec65589cJohn McCall// CHECK: call void [[TEST1_Y_INIT]] 203bf40cb518312dde1c07e44fcae59bc4eec65589cJohn McCall// CHECK: call void [[TEST1_Z_INIT]] 2049df792c199473ac1bd012b8018373680ac00c309Anders Carlsson 205044cc54a7d83c90857187c4cd4a0fd33664a7f7fJohn McCall// rdar://problem/8090834: this should be nounwind 2066bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines// CHECK-NOEXC: define internal void @_GLOBAL__sub_I_global_init.cpp() [[NUW:#[0-9]+]] section "__TEXT,__StaticInit,regular,pure_instructions" { 207899245792776dd219a3c36eb19b42272e270bc0cBill Wendling 208b6d6993e6e6d3daf4d9876794254d20a134e37c2Pirama Arumuga Nainar// CHECK-NOEXC: attributes [[NUW]] = { nounwind{{.*}} } 209b6d6993e6e6d3daf4d9876794254d20a134e37c2Pirama Arumuga Nainar 210b6d6993e6e6d3daf4d9876794254d20a134e37c2Pirama Arumuga Nainar// PR21811: attach the appropriate attribute to the global init function 211b6d6993e6e6d3daf4d9876794254d20a134e37c2Pirama Arumuga Nainar// CHECK-FP: define internal void @_GLOBAL__sub_I_global_init.cpp() [[NUX:#[0-9]+]] section "__TEXT,__StaticInit,regular,pure_instructions" { 212b6d6993e6e6d3daf4d9876794254d20a134e37c2Pirama Arumuga Nainar// CHECK-FP: attributes [[NUX]] = { nounwind {{.*}}"no-frame-pointer-elim-non-leaf"{{.*}} } 213