From c7711e113d6d36feab0fa16e4a8130ae902a5e04 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Mon, 6 Oct 2025 13:23:35 -0700 Subject: [PATCH] [RISCV][TableGen] Correct vTtoGetLlvmTyString for RISC-V tuples. 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*. --- llvm/utils/TableGen/Basic/VTEmitter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; }