Skip to content

Commit f51e586

Browse files
committed
rename IsTailTCO to ShouldGuaranteeTCO
1 parent e5b01ef commit f51e586

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

llvm/lib/Target/X86/X86ISelLoweringCall.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2080,9 +2080,10 @@ X86TargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
20802080
bool Is64Bit = Subtarget.is64Bit();
20812081
bool IsWin64 = Subtarget.isCallingConvWin64(CallConv);
20822082
bool IsSibcall = false;
2083-
bool IsGuaranteeTCO = MF.getTarget().Options.GuaranteedTailCallOpt ||
2084-
CallConv == CallingConv::Tail || CallConv == CallingConv::SwiftTail;
2085-
bool IsCalleePopSRet = !IsGuaranteeTCO && hasCalleePopSRet(Outs, Subtarget);
2083+
bool ShouldGuaranteeTCO = shouldGuaranteeTCO(
2084+
CallConv, MF.getTarget().Options.GuaranteedTailCallOpt);
2085+
bool IsCalleePopSRet =
2086+
!ShouldGuaranteeTCO && hasCalleePopSRet(Outs, Subtarget);
20862087
X86MachineFunctionInfo *X86Info = MF.getInfo<X86MachineFunctionInfo>();
20872088
bool HasNCSR = (CB && isa<CallInst>(CB) &&
20882089
CB->hasFnAttr("no_caller_saved_registers"));
@@ -2129,7 +2130,7 @@ X86TargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
21292130
}
21302131

21312132
bool IsMustTail = CLI.CB && CLI.CB->isMustTailCall();
2132-
if (Subtarget.isPICStyleGOT() && !IsGuaranteeTCO && !IsMustTail) {
2133+
if (Subtarget.isPICStyleGOT() && !ShouldGuaranteeTCO && !IsMustTail) {
21332134
// If we are using a GOT, disable tail calls to external symbols with
21342135
// default visibility. Tail calling such a symbol requires using a GOT
21352136
// relocation, which forces early binding of the symbol. This breaks code
@@ -2151,7 +2152,7 @@ X86TargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
21512152

21522153
// Sibcalls are automatically detected tailcalls which do not require
21532154
// ABI changes.
2154-
IsSibcall = IsSibcall && !IsGuaranteeTCO;
2155+
IsSibcall = IsSibcall && !ShouldGuaranteeTCO;
21552156
}
21562157

21572158
if (isTailCall)
@@ -2171,14 +2172,12 @@ X86TargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
21712172
// This is a sibcall. The memory operands are available in caller's
21722173
// own caller's stack.
21732174
NumBytes = 0;
2174-
else if (IsGuaranteeTCO && canGuaranteeTCO(CallConv))
2175+
else if (ShouldGuaranteeTCO && canGuaranteeTCO(CallConv))
21752176
NumBytes = GetAlignedArgumentStackSize(NumBytes, DAG);
21762177

21772178
// A sibcall is ABI-compatible and does not need to adjust the stack pointer.
21782179
int FPDiff = 0;
2179-
if (isTailCall && !IsSibcall &&
2180-
shouldGuaranteeTCO(CallConv,
2181-
MF.getTarget().Options.GuaranteedTailCallOpt)) {
2180+
if (isTailCall && ShouldGuaranteeTCO && !IsSibcall) {
21822181
// Lower arguments at fp - stackoffset + fpdiff.
21832182
unsigned NumBytesCallerPushed = X86Info->getBytesToPopOnReturn();
21842183

@@ -2475,7 +2474,7 @@ X86TargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
24752474
// For tail calls lower the arguments to the 'real' stack slots. Sibcalls
24762475
// don't need this because the eligibility check rejects calls that require
24772476
// shuffling arguments passed in memory.
2478-
if (!IsSibcall && isTailCall) {
2477+
if (isTailCall && !IsSibcall) {
24792478
// Force all the incoming stack arguments to be loaded from the stack
24802479
// before any new outgoing arguments or the return address are stored to the
24812480
// stack, because the outgoing stack slots may alias the incoming argument
@@ -2971,16 +2970,16 @@ bool X86TargetLowering::IsEligibleForTailCallOptimization(
29712970
bool CCMatch = CallerCC == CalleeCC;
29722971
bool IsCalleeWin64 = Subtarget.isCallingConvWin64(CalleeCC);
29732972
bool IsCallerWin64 = Subtarget.isCallingConvWin64(CallerCC);
2974-
bool IsGuaranteeTCO = DAG.getTarget().Options.GuaranteedTailCallOpt ||
2975-
CalleeCC == CallingConv::Tail || CalleeCC == CallingConv::SwiftTail;
2973+
bool ShouldGuaranteeTCO = shouldGuaranteeTCO(
2974+
CalleeCC, MF.getTarget().Options.GuaranteedTailCallOpt);
29762975

29772976
// Win64 functions have extra shadow space for argument homing. Don't do the
29782977
// sibcall if the caller and callee have mismatched expectations for this
29792978
// space.
29802979
if (IsCalleeWin64 != IsCallerWin64)
29812980
return false;
29822981

2983-
if (IsGuaranteeTCO) {
2982+
if (ShouldGuaranteeTCO) {
29842983
if (canGuaranteeTCO(CalleeCC) && CCMatch)
29852984
return true;
29862985
return false;

0 commit comments

Comments
 (0)