[llvm] bd45629 - [PowerPC][NFC] cleanup isEligibleForTCO
Ting Wang via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 2 20:04:46 PST 2023
Author: Ting Wang
Date: 2023-03-02T23:04:19-05:00
New Revision: bd4562976cfd663de5fe79932fe5ff20a53ec31e
URL: https://github.com/llvm/llvm-project/commit/bd4562976cfd663de5fe79932fe5ff20a53ec31e
DIFF: https://github.com/llvm/llvm-project/commit/bd4562976cfd663de5fe79932fe5ff20a53ec31e.diff
LOG: [PowerPC][NFC] cleanup isEligibleForTCO
The input parameter IsByValArg to isEligibleForTCO() is false in all
cases, so it is considered redundant and should be removed.
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D145028
Added:
Modified:
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index cba5f5cd42f59..03cac2fd6ba1f 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -4850,8 +4850,8 @@ bool PPCTargetLowering::IsEligibleForTailCallOptimization_64SVR4(
const GlobalValue *CalleeGV, CallingConv::ID CalleeCC,
CallingConv::ID CallerCC, const CallBase *CB, bool isVarArg,
const SmallVectorImpl<ISD::OutputArg> &Outs,
- const SmallVectorImpl<ISD::InputArg> &Ins, bool isByValArg,
- const Function *CallerFunc, bool isCalleeExternalSymbol) const {
+ const SmallVectorImpl<ISD::InputArg> &Ins, const Function *CallerFunc,
+ bool isCalleeExternalSymbol) const {
bool TailCallOpt = getTargetMachine().Options.GuaranteedTailCallOpt;
if (DisableSCO && !TailCallOpt) return false;
@@ -4864,8 +4864,7 @@ bool PPCTargetLowering::IsEligibleForTailCallOptimization_64SVR4(
return false;
// Caller contains any byval parameter is not supported.
- if (isByValArg ||
- any_of(Ins, [](const ISD::InputArg &IA) { return IA.Flags.isByVal(); }))
+ if (any_of(Ins, [](const ISD::InputArg &IA) { return IA.Flags.isByVal(); }))
return false;
// Callee contains any byval parameter is not supported, too.
@@ -4937,7 +4936,7 @@ bool PPCTargetLowering::IsEligibleForTailCallOptimization_64SVR4(
bool PPCTargetLowering::IsEligibleForTailCallOptimization(
const GlobalValue *CalleeGV, CallingConv::ID CalleeCC,
CallingConv::ID CallerCC, bool isVarArg,
- const SmallVectorImpl<ISD::InputArg> &Ins, bool isByValArg) const {
+ const SmallVectorImpl<ISD::InputArg> &Ins) const {
if (!getTargetMachine().Options.GuaranteedTailCallOpt)
return false;
@@ -4947,8 +4946,7 @@ bool PPCTargetLowering::IsEligibleForTailCallOptimization(
if (CalleeCC == CallingConv::Fast && CallerCC == CalleeCC) {
// Functions containing by val parameters are not supported.
- if (isByValArg ||
- any_of(Ins, [](const ISD::InputArg &IA) { return IA.Flags.isByVal(); }))
+ if (any_of(Ins, [](const ISD::InputArg &IA) { return IA.Flags.isByVal(); }))
return false;
// Non-PIC/GOT tail calls are supported.
@@ -5667,27 +5665,27 @@ bool PPCTargetLowering::supportsTailCallFor(const CallBase *CB) const {
CalleeFunc->getAttributes(), Outs, *this,
CalleeFunc->getParent()->getDataLayout());
- return isEligibleForTCO(
- CalleeGV, CalleeCC, CallerCC, CB, CalleeFunc->isVarArg(), Outs, Ins,
- false /*IsByValArg*/, CallerFunc, false /*isCalleeExternalSymbol*/);
+ return isEligibleForTCO(CalleeGV, CalleeCC, CallerCC, CB,
+ CalleeFunc->isVarArg(), Outs, Ins, CallerFunc,
+ false /*isCalleeExternalSymbol*/);
}
bool PPCTargetLowering::isEligibleForTCO(
const GlobalValue *CalleeGV, CallingConv::ID CalleeCC,
CallingConv::ID CallerCC, const CallBase *CB, bool isVarArg,
const SmallVectorImpl<ISD::OutputArg> &Outs,
- const SmallVectorImpl<ISD::InputArg> &Ins, bool isByValArg,
- const Function *CallerFunc, bool isCalleeExternalSymbol) const {
+ const SmallVectorImpl<ISD::InputArg> &Ins, const Function *CallerFunc,
+ bool isCalleeExternalSymbol) const {
if (Subtarget.useLongCalls() && !(CB && CB->isMustTailCall()))
return false;
if (Subtarget.isSVR4ABI() && Subtarget.isPPC64())
return IsEligibleForTailCallOptimization_64SVR4(
- CalleeGV, CalleeCC, CallerCC, CB, isVarArg, Outs, Ins, isByValArg,
- CallerFunc, isCalleeExternalSymbol);
+ CalleeGV, CalleeCC, CallerCC, CB, isVarArg, Outs, Ins, CallerFunc,
+ isCalleeExternalSymbol);
else
return IsEligibleForTailCallOptimization(CalleeGV, CalleeCC, CallerCC,
- isVarArg, Ins, isByValArg);
+ isVarArg, Ins);
}
SDValue
@@ -5713,9 +5711,9 @@ PPCTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
const GlobalValue *GV = G ? G->getGlobal() : nullptr;
bool IsCalleeExternalSymbol = isa<ExternalSymbolSDNode>(Callee);
- isTailCall = isEligibleForTCO(GV, CallConv, CallerCC, CB, isVarArg, Outs,
- Ins, false /*isByValArg*/,
- &(MF.getFunction()), IsCalleeExternalSymbol);
+ isTailCall =
+ isEligibleForTCO(GV, CallConv, CallerCC, CB, isVarArg, Outs, Ins,
+ &(MF.getFunction()), IsCalleeExternalSymbol);
if (isTailCall) {
++NumTailCalls;
if (!getTargetMachine().Options.GuaranteedTailCallOpt)
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.h b/llvm/lib/Target/PowerPC/PPCISelLowering.h
index 3401d7db45f84..21fad5a12a8fe 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.h
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.h
@@ -1228,21 +1228,21 @@ namespace llvm {
bool IsEligibleForTailCallOptimization(
const GlobalValue *CalleeGV, CallingConv::ID CalleeCC,
CallingConv::ID CallerCC, bool isVarArg,
- const SmallVectorImpl<ISD::InputArg> &Ins, bool isByValArg) const;
+ const SmallVectorImpl<ISD::InputArg> &Ins) const;
bool IsEligibleForTailCallOptimization_64SVR4(
const GlobalValue *CalleeGV, CallingConv::ID CalleeCC,
CallingConv::ID CallerCC, const CallBase *CB, bool isVarArg,
const SmallVectorImpl<ISD::OutputArg> &Outs,
- const SmallVectorImpl<ISD::InputArg> &Ins, bool isByValArg,
- const Function *CallerFunc, bool isCalleeExternalSymbol) const;
+ const SmallVectorImpl<ISD::InputArg> &Ins, const Function *CallerFunc,
+ bool isCalleeExternalSymbol) const;
bool isEligibleForTCO(const GlobalValue *CalleeGV, CallingConv::ID CalleeCC,
CallingConv::ID CallerCC, const CallBase *CB,
bool isVarArg,
const SmallVectorImpl<ISD::OutputArg> &Outs,
const SmallVectorImpl<ISD::InputArg> &Ins,
- bool isByValArg, const Function *CallerFunc,
+ const Function *CallerFunc,
bool isCalleeExternalSymbol) const;
SDValue EmitTailCallLoadFPAndRetAddr(SelectionDAG &DAG, int SPDiff,
More information about the llvm-commits
mailing list