[llvm-branch-commits] [llvm-branch] r278990 - Merging r278900:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Aug 17 15:03:08 PDT 2016
Author: hans
Date: Wed Aug 17 17:03:07 2016
New Revision: 278990
URL: http://llvm.org/viewvc/llvm-project?rev=278990&view=rev
Log:
Merging r278900:
------------------------------------------------------------------------
r278900 | cycheng | 2016-08-16 20:17:44 -0700 (Tue, 16 Aug 2016) | 12 lines
[ppc64] Don't apply sibling call optimization if callee has any byval arg
This is a quick work around, because in some cases, e.g. caller's stack
size > callee's stack size, we are still able to apply sibling call
optimization even callee has any byval arg.
This patch fix: https://llvm.org/bugs/show_bug.cgi?id=28328
Reviewers: hfinkel kbarton nemanjai amehsan
Subscribers: hans, tjablin
https://reviews.llvm.org/D23441
------------------------------------------------------------------------
Modified:
llvm/branches/release_39/ (props changed)
llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/branches/release_39/test/CodeGen/PowerPC/ppc64-sibcall.ll
Propchange: llvm/branches/release_39/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 17 17:03:07 2016
@@ -1,3 +1,3 @@
/llvm/branches/Apple/Pertwee:110850,110961
/llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,275868-275870,275879,275898,275928,275935,275946,275978,275981,276015,276051,276077,276109,276119,276181,276209,276236-276237,276358,276364,276368,276389,276435,276438,276479,276510,276648,276676,276712,276740,276823,276956,276980,277093,277114,277135,277371,277399,277500,277504,277625,277691,277693,277773,278002,278086,278133,278157,278370,278413,278558,278569,278571,278573,278575,278584,278841
+/llvm/trunk:155241,275868-275870,275879,275898,275928,275935,275946,275978,275981,276015,276051,276077,276109,276119,276181,276209,276236-276237,276358,276364,276368,276389,276435,276438,276479,276510,276648,276676,276712,276740,276823,276956,276980,277093,277114,277135,277371,277399,277500,277504,277625,277691,277693,277773,278002,278086,278133,278157,278370,278413,278558,278569,278571,278573,278575,278584,278841,278900
Modified: llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp?rev=278990&r1=278989&r2=278990&view=diff
==============================================================================
--- llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp (original)
+++ llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp Wed Aug 17 17:03:07 2016
@@ -4033,11 +4033,18 @@ PPCTargetLowering::IsEligibleForTailCall
if (CalleeCC != CallingConv::Fast && CalleeCC != CallingConv::C)
return false;
- // Functions containing by val parameters are not supported.
+ // Caller contains any byval parameter is not supported.
if (std::any_of(Ins.begin(), Ins.end(),
[](const ISD::InputArg& IA) { return IA.Flags.isByVal(); }))
return false;
+ // Callee contains any byval parameter is not supported, too.
+ // Note: This is a quick work around, because in some cases, e.g.
+ // caller's stack size > callee's stack size, we are still able to apply
+ // sibling call optimization. See: https://reviews.llvm.org/D23441#513574
+ if (any_of(Outs, [](const ISD::OutputArg& OA) { return OA.Flags.isByVal(); }))
+ return false;
+
// No TCO/SCO on indirect call because Caller have to restore its TOC
if (!isFunctionGlobalAddress(Callee) &&
!isa<ExternalSymbolSDNode>(Callee))
Modified: llvm/branches/release_39/test/CodeGen/PowerPC/ppc64-sibcall.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/test/CodeGen/PowerPC/ppc64-sibcall.ll?rev=278990&r1=278989&r2=278990&view=diff
==============================================================================
--- llvm/branches/release_39/test/CodeGen/PowerPC/ppc64-sibcall.ll (original)
+++ llvm/branches/release_39/test/CodeGen/PowerPC/ppc64-sibcall.ll Wed Aug 17 17:03:07 2016
@@ -189,3 +189,15 @@ define void @w_caller(i8* %ptr) {
; CHECK-SCO-LABEL: w_caller:
; CHECK-SCO: bl w_callee
}
+
+%struct.byvalTest = type { [8 x i8] }
+ at byval = common global %struct.byvalTest zeroinitializer
+
+define void @byval_callee(%struct.byvalTest* byval %ptr) { ret void }
+define void @byval_caller() {
+ tail call void @byval_callee(%struct.byvalTest* byval @byval)
+ ret void
+
+; CHECK-SCO-LABEL: bl byval_callee
+; CHECK-SCO: bl byval_callee
+}
More information about the llvm-branch-commits
mailing list