Skip to content

Commit d3b19ae

Browse files
committed
[RISCV] Limit VLEN in getOptimalMemOpType to prevent creating invalid MVTs.
We only guarantee that types that are 1024 bytes or smaller exist in the MVT enum. Fixes #139075.
1 parent 55517f5 commit d3b19ae

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23487,7 +23487,9 @@ EVT RISCVTargetLowering::getOptimalMemOpType(const MemOp &Op,
2348723487
// combining will typically form larger LMUL operations from the LMUL1
2348823488
// operations emitted here, and that's okay because combining isn't
2348923489
// introducing new memory operations; it's just merging existing ones.
23490-
const unsigned MinVLenInBytes = Subtarget.getRealMinVLen()/8;
23490+
// NOTE: We limit to 1024 bytes to avoid creating an invalid MVT.
23491+
const unsigned MinVLenInBytes = std::min(Subtarget.getRealMinVLen()/8, 1024U);
23492+
2349123493
if (Op.size() < MinVLenInBytes)
2349223494
// TODO: Figure out short memops. For the moment, do the default thing
2349323495
// which ends up using scalar sequences.

0 commit comments

Comments
 (0)