summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorMichael Kuperstein <michael.m.kuperstein@intel.com>2015-08-06 11:57:15 +0000
committerMichael Kuperstein <michael.m.kuperstein@intel.com>2015-08-06 11:57:15 +0000
commit819ad33f636e564ac49a43ca76e75f0598760a9b (patch)
tree7f222edf959d97f9485ab60add77dfdd03e05972 /clang/lib/CodeGen
parent5890717e7098489ff953a9f96d429a8a02477b2d (diff)
downloadbcm5719-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
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGVTables.cpp2
1 files changed, 2 insertions, 0 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())
OpenPOWER on IntegriCloud