[llvm] [SystemZ] XPLINK64: emit narrow sign/zero-extend instructions for sub-i32 formal args (PR #206833)
Zibi Sarbinowski via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 2 20:51:59 PDT 2026
================
@@ -2152,6 +2152,18 @@ SDValue SystemZTargetLowering::LowerFormalArguments(
assert(PartOffset && "Offset should be non-zero.");
}
}
+ } else if (Subtarget.isTargetXPLINK64() &&
+ (VA.getLocInfo() == CCValAssign::SExt ||
+ VA.getLocInfo() == CCValAssign::ZExt) &&
+ Ins[I].ArgVT.isSimple() &&
+ Ins[I].ArgVT.getSimpleVT().isScalarInteger() &&
+ !Ins[I].Flags.isPointer()) {
----------------
zibi2 wrote:
> Why are these extra checks needed? If you see a SExt or ZExt, it will always be some integer type, so that part should be redundant. What's special about pointers?
You're right that isScalarInteger() is redundant once isSimple() is already checked. That check has been removed.
However, both isSimple() and !isPointer() need to stay:
- isSimple() is needed to exclude non-standard integer types like i24 or i33 — these can also have LocInfo == SExt/ZExt after legalization, but the TRUNCATE path here only makes sense for standard MVT types. Removing it caused regressions in CodeGen/Generic/APIntSextParam.ll, APIntZextParam.ll, and add-with-overflow-24.ll.
- !isPointer() is necessary because CC_XPLINK64_Pointer promotes 32-bit pointers (ptr addrspace(1)) to i64 and sets LocInfo = ZExt, so a pointer formal can also arrive here with LocInfo == ZExt. Without the guard, it would be incorrectly truncated back to i32. Removing it caused a regression in CodeGen/SystemZ/mixed-ptr-sizes.ll.
https://github.com/llvm/llvm-project/pull/206833
More information about the llvm-commits
mailing list