diff options
| author | Michael Kuperstein <michael.m.kuperstein@intel.com> | 2015-08-06 11:57:15 +0000 |
|---|---|---|
| committer | Michael Kuperstein <michael.m.kuperstein@intel.com> | 2015-08-06 11:57:15 +0000 |
| commit | 819ad33f636e564ac49a43ca76e75f0598760a9b (patch) | |
| tree | 7f222edf959d97f9485ab60add77dfdd03e05972 | |
| parent | 5890717e7098489ff953a9f96d429a8a02477b2d (diff) | |
| download | bcm5719-llvm-819ad33f636e564ac49a43ca76e75f0598760a9b.tar.gz bcm5719-llvm-819ad33f636e564ac49a43ca76e75f0598760a9b.zip | |
Mark calls in thunk functions as tail-call optimization candidates
When a thunk is generated with a call to the original adjusted function,
the thunk appears in the debugger call stack. We want the backend to perform
tail-call optimization on the call, to make it invisible to the debugger.
This fixes PR24235
Patch by: amjad.aboud@intel.com
Differential Revision: http://reviews.llvm.org/D11476
llvm-svn: 244207
| -rw-r--r-- | clang/lib/CodeGen/CGVTables.cpp | 2 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/microsoft-abi-structors.cpp | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp index 42cfd36e845..83f45b5da2c 100644 --- a/clang/lib/CodeGen/CGVTables.cpp +++ b/clang/lib/CodeGen/CGVTables.cpp @@ -312,6 +312,8 @@ void CodeGenFunction::EmitCallAndReturnForThunk(llvm::Value *Callee, // Consider return adjustment if we have ThunkInfo. if (Thunk && !Thunk->Return.isEmpty()) RV = PerformReturnAdjustment(*this, ResultType, RV, *Thunk); + else if (llvm::CallInst* Call = dyn_cast<llvm::CallInst>(CallOrInvoke)) + Call->setTailCallKind(llvm::CallInst::TCK_Tail); // Emit return. if (!ResultType->isVoidType() && Slot.isNull()) diff --git a/clang/test/CodeGenCXX/microsoft-abi-structors.cpp b/clang/test/CodeGenCXX/microsoft-abi-structors.cpp index 594dea473ef..88400e7c0bd 100644 --- a/clang/test/CodeGenCXX/microsoft-abi-structors.cpp +++ b/clang/test/CodeGenCXX/microsoft-abi-structors.cpp @@ -176,7 +176,7 @@ void foo() { // Do an adjustment from B* to C*. // DTORS2: getelementptr i8, i8* %{{.*}}, i32 -4 // DTORS2: bitcast i8* %{{.*}} to %"struct.dtor_in_second_nvbase::C"* -// DTORS2: %[[CALL:.*]] = call x86_thiscallcc i8* @"\01??_GC@dtor_in_second_nvbase@@UAEPAXI@Z" +// DTORS2: %[[CALL:.*]] = tail call x86_thiscallcc i8* @"\01??_GC@dtor_in_second_nvbase@@UAEPAXI@Z" // DTORS2: ret i8* %[[CALL]] } |

