Skip to content

Commit b3bf591

Browse files
committed
address comment
1 parent d5016bc commit b3bf591

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9114,18 +9114,22 @@ std::pair<SDValue, SDValue> SelectionDAG::getStrlen(SDValue Chain,
91149114
TargetLowering::ArgListTy Args = {GetEntry(PT, Src)};
91159115

91169116
TargetLowering::CallLoweringInfo CLI(*this);
9117-
bool IsTailCall = false;
9118-
bool ReturnsFirstArg = CI && funcReturnsFirstArgOfCall(*CI);
9119-
IsTailCall = CI && CI->isTailCall() &&
9120-
isInTailCallPosition(*CI, getTarget(), ReturnsFirstArg);
91219117

9122-
CLI.setDebugLoc(dl)
9123-
.setChain(Chain)
9124-
.setLibCallee(
9125-
TLI->getLibcallCallingConv(RTLIB::STRLEN), CI->getType(),
9126-
getExternalSymbol(LibCallName, TLI->getPointerTy(getDataLayout())),
9127-
std::move(Args))
9128-
.setTailCall(IsTailCall);
9118+
// TODO: Intentionally not marking this libcall as a tail call.
9119+
//
9120+
// Why:
9121+
// - The only current in-tree user of SelectionDAG::getStrlen is the AIX path,
9122+
// where generic tail-calling to libcalls is not safe due to ABI
9123+
// constraints around r2 (TOC). We don¡¯t have a reliable way to validate a
9124+
// tail call here.
9125+
//
9126+
// If another target starts using this and does support tail calls to
9127+
// libcalls, re-enable `.setTailCall(...)` under a target guard and add a
9128+
// test.
9129+
CLI.setDebugLoc(dl).setChain(Chain).setLibCallee(
9130+
TLI->getLibcallCallingConv(RTLIB::STRLEN), CI->getType(),
9131+
getExternalSymbol(LibCallName, TLI->getProgramPointerTy(getDataLayout())),
9132+
std::move(Args));
91299133

91309134
return TLI->LowerCallTo(CLI);
91319135
}

llvm/lib/Target/PowerPC/PPCSelectionDAGInfo.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,5 @@ std::pair<SDValue, SDValue>
3333
PPCSelectionDAGInfo::EmitTargetCodeForStrlen(SelectionDAG &DAG, const SDLoc &DL,
3434
SDValue Chain, SDValue Src,
3535
const CallInst *CI) const {
36-
EVT PtrVT = Src.getValueType();
3736
return DAG.getStrlen(Chain, DL, Src, CI);
3837
}

0 commit comments

Comments
 (0)