[llvm] [RISCV][TableGen] Correct vTtoGetLlvmTyString for RISC-V tuples. (PR #162152)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 6 13:28:29 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-tablegen
Author: Craig Topper (topperc)
<details>
<summary>Changes</summary>
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*.
---
Full diff: https://github.com/llvm/llvm-project/pull/162152.diff
1 Files Affected:
- (modified) llvm/utils/TableGen/Basic/VTEmitter.cpp (+2-2)
``````````diff
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;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/162152
More information about the llvm-commits
mailing list