Skip to content

Commit a522ae3

Browse files
authored
ARM: Remove unnecessary manual ABI lowering for sincos_stret (#166040)
LowerCallTo handles all of the ABI details, including the load of implicit sret return to the expected result positions.
1 parent ed53c41 commit a522ae3

File tree

1 file changed

+2
-37
lines changed

1 file changed

+2
-37
lines changed

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9869,32 +9869,12 @@ SDValue ARMTargetLowering::LowerFSINCOS(SDValue Op, SelectionDAG &DAG) const {
98699869
assert(Subtarget->isTargetDarwin());
98709870

98719871
Type *ArgTy = ArgVT.getTypeForEVT(*DAG.getContext());
9872-
auto PtrVT = getPointerTy(DAG.getDataLayout());
9873-
9874-
MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo();
98759872

98769873
// Pair of floats / doubles used to pass the result.
98779874
Type *RetTy = StructType::get(ArgTy, ArgTy);
98789875
auto &DL = DAG.getDataLayout();
98799876

98809877
ArgListTy Args;
9881-
bool ShouldUseSRet = getTM().isAPCS_ABI();
9882-
SDValue SRet;
9883-
if (ShouldUseSRet) {
9884-
// Create stack object for sret.
9885-
const uint64_t ByteSize = DL.getTypeAllocSize(RetTy);
9886-
const Align StackAlign = DL.getPrefTypeAlign(RetTy);
9887-
int FrameIdx = MFI.CreateStackObject(ByteSize, StackAlign, false);
9888-
SRet = DAG.getFrameIndex(FrameIdx, getPointerTy(DL));
9889-
9890-
ArgListEntry Entry(SRet, PointerType::getUnqual(RetTy->getContext()));
9891-
Entry.IsSExt = false;
9892-
Entry.IsZExt = false;
9893-
Entry.IsSRet = true;
9894-
Args.push_back(Entry);
9895-
RetTy = Type::getVoidTy(*DAG.getContext());
9896-
}
9897-
98989878
Args.emplace_back(Arg, ArgTy);
98999879

99009880
StringRef LibcallName = getLibcallImplName(SincosStret);
@@ -9904,25 +9884,10 @@ SDValue ARMTargetLowering::LowerFSINCOS(SDValue Op, SelectionDAG &DAG) const {
99049884
TargetLowering::CallLoweringInfo CLI(DAG);
99059885
CLI.setDebugLoc(dl)
99069886
.setChain(DAG.getEntryNode())
9907-
.setCallee(CC, RetTy, Callee, std::move(Args))
9908-
.setDiscardResult(ShouldUseSRet);
9887+
.setCallee(CC, RetTy, Callee, std::move(Args));
99099888
std::pair<SDValue, SDValue> CallResult = LowerCallTo(CLI);
99109889

9911-
if (!ShouldUseSRet)
9912-
return CallResult.first;
9913-
9914-
SDValue LoadSin =
9915-
DAG.getLoad(ArgVT, dl, CallResult.second, SRet, MachinePointerInfo());
9916-
9917-
// Address of cos field.
9918-
SDValue Add = DAG.getNode(ISD::ADD, dl, PtrVT, SRet,
9919-
DAG.getIntPtrConstant(ArgVT.getStoreSize(), dl));
9920-
SDValue LoadCos =
9921-
DAG.getLoad(ArgVT, dl, LoadSin.getValue(1), Add, MachinePointerInfo());
9922-
9923-
SDVTList Tys = DAG.getVTList(ArgVT, ArgVT);
9924-
return DAG.getNode(ISD::MERGE_VALUES, dl, Tys,
9925-
LoadSin.getValue(0), LoadCos.getValue(0));
9890+
return CallResult.first;
99269891
}
99279892

99289893
SDValue ARMTargetLowering::LowerWindowsDIVLibCall(SDValue Op, SelectionDAG &DAG,

0 commit comments

Comments
 (0)