diff options
author | John McCall <rjmccall@apple.com> | 2010-02-02 08:02:49 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-02-02 08:02:49 +0000 |
commit | fb8b69aef3377aaa786d1278aaae7e7b04ac095f (patch) | |
tree | 39d41f571f9024781d92428c981d0a06474684c9 /test/CodeGenCXX/global-init.cpp | |
parent | 2e13db8bc64bc99922b0aeb45443c681c1643c82 (diff) |
Codegen CXXConstructExprs with trivial constructors as constants.
Eliminates a lot of spurious global initializers, fixing PR6205.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95077 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/global-init.cpp')
-rw-r--r-- | test/CodeGenCXX/global-init.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/CodeGenCXX/global-init.cpp b/test/CodeGenCXX/global-init.cpp index b375aef4c8..fd8c159755 100644 --- a/test/CodeGenCXX/global-init.cpp +++ b/test/CodeGenCXX/global-init.cpp @@ -7,6 +7,10 @@ struct A { struct B { B(); ~B(); }; +struct C { void *field; }; + +// CHECK: @c = global %struct.C zeroinitializer, align 8 + // CHECK: call void @_ZN1AC1Ev(%struct.A* @a) // CHECK: call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.A*)* @_ZN1AD1Ev to void (i8*)*), i8* getelementptr inbounds (%struct.A* @a, i32 0, i32 0), i8* bitcast (i8** @__dso_handle to i8*)) A a; @@ -14,3 +18,9 @@ A a; // CHECK: call void @_ZN1BC1Ev(%struct.A* @b) // CHECK: call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.A*)* @_ZN1BD1Ev to void (i8*)*), i8* getelementptr inbounds (%struct.A* @b, i32 0, i32 0), i8* bitcast (i8** @__dso_handle to i8*)) B b; + +// PR6205: this should not require a global initializer +// CHECK-NOT: call void @_ZN1CC1Ev(%struct.C* @c) +C c; + +// CHECK: define internal void @__cxx_global_initialization() { |