[llvm-branch-commits] [cfe-branch] r196666 - Merging r196658:
Bill Wendling
isanbard at gmail.com
Sat Dec 7 13:19:03 PST 2013
Author: void
Date: Sat Dec 7 15:19:02 2013
New Revision: 196666
URL: http://llvm.org/viewvc/llvm-project?rev=196666&view=rev
Log:
Merging r196658:
------------------------------------------------------------------------
r196658 | d0k | 2013-12-07 08:12:52 -0800 (Sat, 07 Dec 2013) | 7 lines
CodeGen: Don't emit linkage on thunks that aren't emitted because they're vararg.
This can happen when we're trying to emit a thunk with available_externally
linkage with optimization enabled but bail because it doesn't make sense
for vararg functions.
PR18098.
------------------------------------------------------------------------
Modified:
cfe/branches/release_34/ (props changed)
cfe/branches/release_34/lib/CodeGen/CGVTables.cpp
cfe/branches/release_34/test/CodeGenCXX/thunks.cpp
Propchange: cfe/branches/release_34/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Dec 7 15:19:02 2013
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:195126,195128,195135-195136,195146,195149,195154,195158,195163,195168,195174,195249,195268,195283,195303,195326,195329,195367,195384,195409,195420,195422,195501,195547,195556,195558,195587,195620,195635,195669,195687,195693,195710,195713,195716,195756,195760,195768,195777,195789,195792,195804,195827,195843-195844,195877,195887-195888,195897,195903,195905-195906,195932,195936-195943,195970,195983,196045,196048,196050,196058,196114-196115,196153,196206,196215,196370,196387,196423,196454,196459,196532,196538
+/cfe/trunk:195126,195128,195135-195136,195146,195149,195154,195158,195163,195168,195174,195249,195268,195283,195303,195326,195329,195367,195384,195409,195420,195422,195501,195547,195556,195558,195587,195620,195635,195669,195687,195693,195710,195713,195716,195756,195760,195768,195777,195789,195792,195804,195827,195843-195844,195877,195887-195888,195897,195903,195905-195906,195932,195936-195943,195970,195983,196045,196048,196050,196058,196114-196115,196153,196206,196215,196370,196387,196423,196454,196459,196532,196538,196658
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_34/lib/CodeGen/CGVTables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/lib/CodeGen/CGVTables.cpp?rev=196666&r1=196665&r2=196666&view=diff
==============================================================================
--- cfe/branches/release_34/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/branches/release_34/lib/CodeGen/CGVTables.cpp Sat Dec 7 15:19:02 2013
@@ -422,14 +422,15 @@ void CodeGenVTables::emitThunk(GlobalDec
// expensive/sucky at the moment, so don't generate the thunk unless
// we have to.
// FIXME: Do something better here; GenerateVarArgsThunk is extremely ugly.
- if (!UseAvailableExternallyLinkage)
+ if (!UseAvailableExternallyLinkage) {
CodeGenFunction(CGM).GenerateVarArgsThunk(ThunkFn, FnInfo, GD, Thunk);
+ CGM.getCXXABI().setThunkLinkage(ThunkFn, ForVTable);
+ }
} else {
// Normal thunk body generation.
CodeGenFunction(CGM).GenerateThunk(ThunkFn, FnInfo, GD, Thunk);
+ CGM.getCXXABI().setThunkLinkage(ThunkFn, ForVTable);
}
-
- CGM.getCXXABI().setThunkLinkage(ThunkFn, ForVTable);
}
void CodeGenVTables::maybeEmitThunkForVTable(GlobalDecl GD,
Modified: cfe/branches/release_34/test/CodeGenCXX/thunks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/test/CodeGenCXX/thunks.cpp?rev=196666&r1=196665&r2=196666&view=diff
==============================================================================
--- cfe/branches/release_34/test/CodeGenCXX/thunks.cpp (original)
+++ cfe/branches/release_34/test/CodeGenCXX/thunks.cpp Sat Dec 7 15:19:02 2013
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -triple=x86_64-pc-linux-gnu -munwind-tables -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-pc-linux-gnu -munwind-tables -emit-llvm -o - -O1 -disable-llvm-optzns | FileCheck %s
// RUN: %clang_cc1 %s -triple=x86_64-pc-linux-gnu -munwind-tables -fhidden-weak-vtables -emit-llvm -o - | FileCheck -check-prefix=CHECK-HIDDEN %s
namespace Test1 {
@@ -342,6 +343,27 @@ namespace Test14 {
// CHECK: define void @_ZThn8_N6Test141C1fEv({{.*}}) unnamed_addr [[NUW:#[0-9]+]]
}
+// Varargs non-covariant thunk test.
+// PR18098
+namespace Test15 {
+ struct A {
+ virtual ~A();
+ };
+ struct B {
+ virtual void f(int x, ...);
+ };
+ struct C : A, B {
+ virtual void c();
+ virtual void f(int x, ...);
+ };
+ void C::c() {}
+
+ // C::c
+ // CHECK: declare void @_ZN6Test151C1fEiz
+ // non-virtual thunk to C::f
+ // CHECK: declare void @_ZThn8_N6Test151C1fEiz
+}
+
/**** The following has to go at the end of the file ****/
// This is from Test5:
More information about the llvm-branch-commits
mailing list