Skip to content

Commit 0e775b8

Browse files
committed
[RISCV] Move fixed vector LocVT change in CC_RISCV. NFC
We don't need to change the LocVT unless we succesfully allocated a register.
1 parent fa65804 commit 0e775b8

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

llvm/lib/Target/RISCV/RISCVCallingConv.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,6 @@ bool llvm::CC_RISCV(unsigned ValNo, MVT ValVT, MVT LocVT,
395395
return false;
396396
}
397397

398-
// Fixed-length vectors are located in the corresponding scalable-vector
399-
// container types.
400-
if (ValVT.isFixedLengthVector())
401-
LocVT = TLI.getContainerForFixedLengthVector(LocVT);
402-
403398
// Split arguments might be passed indirectly, so keep track of the pending
404399
// values. Split vectors are passed via a mix of registers and indirectly, so
405400
// treat them as we would any other argument.
@@ -443,7 +438,12 @@ bool llvm::CC_RISCV(unsigned ValNo, MVT ValVT, MVT LocVT,
443438
Reg = State.AllocateReg(ArgFPR64s);
444439
else if (ValVT.isVector() || ValVT.isRISCVVectorTuple()) {
445440
Reg = allocateRVVReg(ValVT, ValNo, State, TLI);
446-
if (!Reg) {
441+
if (Reg) {
442+
// Fixed-length vectors are located in the corresponding scalable-vector
443+
// container types.
444+
if (ValVT.isFixedLengthVector())
445+
LocVT = TLI.getContainerForFixedLengthVector(LocVT);
446+
} else {
447447
// For return values, the vector must be passed fully via registers or
448448
// via the stack.
449449
// FIXME: The proposed vector ABI only mandates v8-v15 for return values,
@@ -458,8 +458,6 @@ bool llvm::CC_RISCV(unsigned ValNo, MVT ValVT, MVT LocVT,
458458
LocVT = XLenVT;
459459
LocInfo = CCValAssign::Indirect;
460460
} else {
461-
// Pass fixed-length vectors on the stack.
462-
LocVT = ValVT;
463461
StoreSizeBytes = ValVT.getStoreSize();
464462
// Align vectors to their element sizes, being careful for vXi1
465463
// vectors.

0 commit comments

Comments
 (0)