[llvm] c830c84 - [RISCV][TableGen] Correct vTtoGetLlvmTyString for RISC-V tuples. (#162152)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 6 14:09:18 PDT 2025


Author: Craig Topper
Date: 2025-10-06T21:09:14Z
New Revision: c830c843ab249940811f0bb15924ec94a7b01538

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

LOG: [RISCV][TableGen] Correct vTtoGetLlvmTyString for RISC-V tuples. (#162152)

RISC-V tuples use "NF" not "nElem" to store the number of fields in the
segment.

This fixes a crash when lowering a function with tuple return.
getReturnInfo in CallLowering.cpp does Type*->EVT->Type* and we were
incorrectly converting EVT to Type*.

Added: 
    

Modified: 
    llvm/utils/TableGen/Basic/VTEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/Basic/VTEmitter.cpp b/llvm/utils/TableGen/Basic/VTEmitter.cpp
index c6b4d0b56c02b..301b27d2ebc5c 100644
--- a/llvm/utils/TableGen/Basic/VTEmitter.cpp
+++ b/llvm/utils/TableGen/Basic/VTEmitter.cpp
@@ -33,11 +33,11 @@ static void vTtoGetLlvmTyString(raw_ostream &OS, const Record *VT) {
   bool IsRISCVVecTuple = VT->getValueAsBit("isRISCVVecTuple");
 
   if (IsRISCVVecTuple) {
-    unsigned NElem = VT->getValueAsInt("nElem");
+    unsigned NF = VT->getValueAsInt("NF");
     unsigned Sz = VT->getValueAsInt("Size");
     OS << "TargetExtType::get(Context, \"riscv.vector.tuple\", "
           "ScalableVectorType::get(Type::getInt8Ty(Context), "
-       << (Sz / (NElem * 8)) << "), " << NElem << ")";
+       << (Sz / (NF * 8)) << "), " << NF << ")";
     return;
   }
 


        


More information about the llvm-commits mailing list