[llvm] 0e775b8 - [RISCV] Move fixed vector LocVT change in CC_RISCV. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 7 12:47:40 PDT 2024


Author: Craig Topper
Date: 2024-09-07T12:47:24-07:00
New Revision: 0e775b8c6f14fb72892d0c838a66bf24a2dc8959

URL: https://github.com/llvm/llvm-project/commit/0e775b8c6f14fb72892d0c838a66bf24a2dc8959
DIFF: https://github.com/llvm/llvm-project/commit/0e775b8c6f14fb72892d0c838a66bf24a2dc8959.diff

LOG: [RISCV] Move fixed vector LocVT change in CC_RISCV. NFC

We don't need to change the LocVT unless we succesfully allocated
a register.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVCallingConv.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVCallingConv.cpp b/llvm/lib/Target/RISCV/RISCVCallingConv.cpp
index e81cddb086f062..7c70f1f8d1ff8d 100644
--- a/llvm/lib/Target/RISCV/RISCVCallingConv.cpp
+++ b/llvm/lib/Target/RISCV/RISCVCallingConv.cpp
@@ -395,11 +395,6 @@ bool llvm::CC_RISCV(unsigned ValNo, MVT ValVT, MVT LocVT,
     return false;
   }
 
-  // Fixed-length vectors are located in the corresponding scalable-vector
-  // container types.
-  if (ValVT.isFixedLengthVector())
-    LocVT = TLI.getContainerForFixedLengthVector(LocVT);
-
   // Split arguments might be passed indirectly, so keep track of the pending
   // values. Split vectors are passed via a mix of registers and indirectly, so
   // treat them as we would any other argument.
@@ -443,7 +438,12 @@ bool llvm::CC_RISCV(unsigned ValNo, MVT ValVT, MVT LocVT,
     Reg = State.AllocateReg(ArgFPR64s);
   else if (ValVT.isVector() || ValVT.isRISCVVectorTuple()) {
     Reg = allocateRVVReg(ValVT, ValNo, State, TLI);
-    if (!Reg) {
+    if (Reg) {
+      // Fixed-length vectors are located in the corresponding scalable-vector
+      // container types.
+      if (ValVT.isFixedLengthVector())
+        LocVT = TLI.getContainerForFixedLengthVector(LocVT);
+    } else {
       // For return values, the vector must be passed fully via registers or
       // via the stack.
       // 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,
         LocVT = XLenVT;
         LocInfo = CCValAssign::Indirect;
       } else {
-        // Pass fixed-length vectors on the stack.
-        LocVT = ValVT;
         StoreSizeBytes = ValVT.getStoreSize();
         // Align vectors to their element sizes, being careful for vXi1
         // vectors.


        


More information about the llvm-commits mailing list