diff options
author | Piotr Padlewski <prazek@google.com> | 2015-07-24 04:04:49 +0000 |
---|---|---|
committer | Piotr Padlewski <prazek@google.com> | 2015-07-24 04:04:49 +0000 |
commit | a68a78751fb0d4eb7eb047365a66ea9becbc6a28 (patch) | |
tree | a0e518429cfb8bba71d662ba042c65ee702eccf1 /clang/test/CodeGenCXX/vtable-linkage.cpp | |
parent | 5d8e569926773bea0e55d00a644c17ca202c29cc (diff) | |
download | bcm5719-llvm-a68a78751fb0d4eb7eb047365a66ea9becbc6a28.tar.gz bcm5719-llvm-a68a78751fb0d4eb7eb047365a66ea9becbc6a28.zip |
Generating available_externally vtables for outline virtual functions
Generating available_externally vtables for optimizations purposes.
Unfortunatelly ItaniumABI doesn't guarantee that we will be able to
refer to virtual inline method by name.
But when we don't have any inline virtual methods, and key function is
not defined in this TU, we can generate that there will be vtable and
mark it as available_externally.
This is patch will help devirtualize better.
Differential Revision: http://reviews.llvm.org/D11441
llvm-svn: 243090
Diffstat (limited to 'clang/test/CodeGenCXX/vtable-linkage.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/vtable-linkage.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/test/CodeGenCXX/vtable-linkage.cpp b/clang/test/CodeGenCXX/vtable-linkage.cpp index 5cbd3897a1f..ff398ffa61d 100644 --- a/clang/test/CodeGenCXX/vtable-linkage.cpp +++ b/clang/test/CodeGenCXX/vtable-linkage.cpp @@ -139,10 +139,11 @@ void use_F() { // CHECK-OPT-DAG: @_ZTV1FIiE = external unnamed_addr constant // E<int> is an explicit template instantiation declaration. It has a -// key function that is not instantiated, so we should only reference -// its vtable, not define it. +// key function is not instantiated, so we know that vtable definition +// will be generated in TU where key function will be defined +// so we can mark it as available_externally (only with optimizations) // CHECK-DAG: @_ZTV1EIiE = external unnamed_addr constant -// CHECK-OPT-DAG: @_ZTV1EIiE = external unnamed_addr constant +// CHECK-OPT-DAG: @_ZTV1EIiE = available_externally unnamed_addr constant // The anonymous struct for e has no linkage, so the vtable should have // internal linkage. @@ -196,8 +197,8 @@ void use_H() { // CHECK-DAG: @_ZTT1IIiE = external unnamed_addr constant // CHECK-NOT: @_ZTC1IIiE // -// CHECK-OPT-DAG: @_ZTV1IIiE = external unnamed_addr constant -// CHECK-OPT-DAG: @_ZTT1IIiE = external unnamed_addr constant +// CHECK-OPT-DAG: @_ZTV1IIiE = available_externally unnamed_addr constant +// CHECK-OPT-DAG: @_ZTT1IIiE = available_externally unnamed_addr constant struct VBase1 { virtual void f(); }; struct VBase2 : virtual VBase1 {}; template<typename T> struct I : VBase2 {}; |