Skip to content

Commit c830c84

Browse files
authored
[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*.
1 parent 30b9b28 commit c830c84

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/utils/TableGen/Basic/VTEmitter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ static void vTtoGetLlvmTyString(raw_ostream &OS, const Record *VT) {
3333
bool IsRISCVVecTuple = VT->getValueAsBit("isRISCVVecTuple");
3434

3535
if (IsRISCVVecTuple) {
36-
unsigned NElem = VT->getValueAsInt("nElem");
36+
unsigned NF = VT->getValueAsInt("NF");
3737
unsigned Sz = VT->getValueAsInt("Size");
3838
OS << "TargetExtType::get(Context, \"riscv.vector.tuple\", "
3939
"ScalableVectorType::get(Type::getInt8Ty(Context), "
40-
<< (Sz / (NElem * 8)) << "), " << NElem << ")";
40+
<< (Sz / (NF * 8)) << "), " << NF << ")";
4141
return;
4242
}
4343

0 commit comments

Comments
 (0)