[llvm] [SystemZ] Handle IR struct arguments correctly. (PR #169583)
Jonas Paulsson via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 26 08:06:12 PST 2025
================
@@ -2074,16 +2096,26 @@ SDValue SystemZTargetLowering::LowerFormalArguments(
MachinePointerInfo()));
// If the original argument was split (e.g. i128), we need
// to load all parts of it here (using the same address).
- unsigned ArgIndex = Ins[I].OrigArgIndex;
- assert (Ins[I].PartOffset == 0);
- while (I + 1 != E && Ins[I + 1].OrigArgIndex == ArgIndex) {
- CCValAssign &PartVA = ArgLocs[I + 1];
- unsigned PartOffset = Ins[I + 1].PartOffset;
- SDValue Address = DAG.getNode(ISD::ADD, DL, PtrVT, ArgValue,
- DAG.getIntPtrConstant(PartOffset, DL));
- InVals.push_back(DAG.getLoad(PartVA.getValVT(), DL, Chain, Address,
- MachinePointerInfo()));
- ++I;
+ MVT PartVT;
+ unsigned NumParts;
+ if (analyzeArgSplit(Ins, ArgLocs, I, PartVT, NumParts)) {
+ // TODO: It is strange that while LowerCallTo() sets the PartOffset
+ // relative to the first split part LowerArguments() sets the offset
+ // from the beginning of the struct. So with {i32, i256}, the
+ // PartOffset for the i256 parts are differently handled. Try to
+ // remove that difference and use PartOffset directly here (instead
+ // of SplitBaseOffs).
----------------
JonPsson1 wrote:
I tried removing it, and found only a single test case to fail, and this was in SystemZ, so it seems doable, if considering only the public targets, at least. Given that it is "weird", maybe it would be worth trying as a follow up?
https://github.com/llvm/llvm-project/pull/169583
More information about the llvm-commits
mailing list