[llvm] [AIX] Handle arbitrary sized integers when lowering formal arguments passed on the stack (PR #149351)
David Tenty via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 22 07:17:11 PDT 2025
================
@@ -7296,9 +7296,19 @@ SDValue PPCTargetLowering::LowerFormalArguments_AIX(
if (!ArgVT.isVector() && !ValVT.isVector() && ArgVT.isInteger() &&
ValVT.isInteger() &&
ArgVT.getScalarSizeInBits() < ValVT.getScalarSizeInBits()) {
- SDValue ArgValueTrunc = DAG.getNode(
- ISD::TRUNCATE, dl, ArgVT.getSimpleVT() == MVT::i1 ? MVT::i8 : ArgVT,
- ArgValue);
+ // It is possible to have either real integer values that aren't
+ // the power of two sizes, or integers that were not originally
+ // integers. In the latter case, these could have came from structs,
+ // and these integers would not have an extend on the parameter.
+ // Since these types of integers do not have an extend specified
+ // in the first place, the type of extend that we do should not matter.
+ EVT TruncatedArgVT;
+ if (ArgVT.isSimple())
+ TruncatedArgVT = ArgVT.getSimpleVT() == MVT::i1 ? MVT::i8 : ArgVT;
+ else
+ TruncatedArgVT = ArgVT;
----------------
daltenty wrote:
nit: this could simplify, since the default is to return ArgVT:
```suggestion
TruncatedArgVT = ArgVT.isSimple() && ArgVT.getSimpleVT() == MVT::i1 ? MVT::i8 : ArgVT;
```
I like writing it this way, because it makes clear that the only real remaining special case is i1's.
https://github.com/llvm/llvm-project/pull/149351
More information about the llvm-commits
mailing list