diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-09-16 15:18:21 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-09-16 15:18:21 +0000 |
| commit | 1e4df92f4939a79a77be57ff145a252730749b11 (patch) | |
| tree | 939202d44c99415dbf25610d58610db8a446f3fb /clang/test/CodeGenCXX/destructors.cpp | |
| parent | 65f105719121ecddd8826f6d1f4f3b60d7d3a28d (diff) | |
| download | bcm5719-llvm-1e4df92f4939a79a77be57ff145a252730749b11.tar.gz bcm5719-llvm-1e4df92f4939a79a77be57ff145a252730749b11.zip | |
Add support for putting constructors and destructos in explicit comdats.
There are situations when clang knows that the C1 and C2 constructors
or the D1 and D2 destructors are identical. We already optimize some
of these cases, but cannot optimize it when the GlobalValue is
weak_odr.
The problem with weak_odr is that an old TU seeing the same code will
have a C1 and a C2 comdat with the corresponding symbols. We cannot
suddenly start putting the C2 symbol in the C1 comdat as we cannot
guarantee that the linker will not pick a .o with only C1 in it.
The solution implemented by GCC is to expand the ABI to have a comdat
whose name uses a C5/D5 suffix and always has both symbols. That is
what this patch implements.
llvm-svn: 217874
Diffstat (limited to 'clang/test/CodeGenCXX/destructors.cpp')
| -rw-r--r-- | clang/test/CodeGenCXX/destructors.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/test/CodeGenCXX/destructors.cpp b/clang/test/CodeGenCXX/destructors.cpp index 0bfc8ec451d..bc9a683be5d 100644 --- a/clang/test/CodeGenCXX/destructors.cpp +++ b/clang/test/CodeGenCXX/destructors.cpp @@ -204,18 +204,14 @@ namespace test3 { // CHECK4: call void @_ZN5test312_GLOBAL__N_11DD0Ev( // CHECK4: ret void - // CHECK4-LABEL: define internal void @_ZThn8_N5test312_GLOBAL__N_11CD1Ev( - // CHECK4: getelementptr inbounds i8* {{.*}}, i64 -8 - // CHECK4: call void @_ZN5test312_GLOBAL__N_11CD2Ev( - // CHECK4: ret void + // CHECK4-LABEL: declare void @_ZN5test31BD2Ev( + // CHECK4-LABEL: declare void @_ZN5test31AD2Ev( // CHECK4-LABEL: define internal void @_ZN5test312_GLOBAL__N_11CD2Ev(%"struct.test3::(anonymous namespace)::C"* %this) unnamed_addr // CHECK4: invoke void @_ZN5test31BD2Ev( // CHECK4: call void @_ZN5test31AD2Ev( // CHECK4: ret void - // CHECK4: declare void @_ZN5test31BD2Ev( - // CHECK4: declare void @_ZN5test31AD2Ev( // CHECK4-LABEL: define internal void @_ZN5test312_GLOBAL__N_11CD0Ev(%"struct.test3::(anonymous namespace)::C"* %this) unnamed_addr // CHECK4: invoke void @_ZN5test312_GLOBAL__N_11CD2Ev( @@ -226,6 +222,11 @@ namespace test3 { // CHECK4: call void @_ZdlPv({{.*}}) [[NUW]] // CHECK4: resume { i8*, i32 } + // CHECK4-LABEL: define internal void @_ZThn8_N5test312_GLOBAL__N_11CD1Ev( + // CHECK4: getelementptr inbounds i8* {{.*}}, i64 -8 + // CHECK4: call void @_ZN5test312_GLOBAL__N_11CD2Ev( + // CHECK4: ret void + // CHECK4-LABEL: define internal void @_ZThn8_N5test312_GLOBAL__N_11CD0Ev( // CHECK4: getelementptr inbounds i8* {{.*}}, i64 -8 // CHECK4: call void @_ZN5test312_GLOBAL__N_11CD0Ev( |

