summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/PowerPC/PPCISelLowering.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index f885127e6aa..3fe9fe73499 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -4397,18 +4397,13 @@ hasSameArgumentList(const Function *CallerFn, ImmutableCallSite CS) {
static bool
areCallingConvEligibleForTCO_64SVR4(CallingConv::ID CallerCC,
CallingConv::ID CalleeCC) {
- // tail calls are possible with fastcc and ccc.
- auto isTailCallableCC = [] (CallingConv::ID CC){
- return CC == CallingConv::C || CC == CallingConv::Fast;
- };
- if (!isTailCallableCC(CallerCC) || !isTailCallableCC(CalleeCC))
+ // Tail or Sibling call optimization (TCO/SCO) needs callee and caller to
+ // have the same calling convention.
+ if (CallerCC != CalleeCC)
return false;
- // We can safely tail call both fastcc and ccc callees from a c calling
- // convention caller. If the caller is fastcc, we may have less stack space
- // then a non-fastcc caller with the same signature so disable tail-calls in
- // that case.
- return CallerCC == CallingConv::C || CallerCC == CalleeCC;
+ // Tail or Sibling calls can be done with fastcc/ccc.
+ return (CallerCC == CallingConv::Fast || CallerCC == CallingConv::C);
}
bool
OpenPOWER on IntegriCloud