Skip to content

Commit 3fd27bd

Browse files
committed
Set max bytes
Created using spr 1.3.6-beta.1
1 parent 13fcd84 commit 3fd27bd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2508,7 +2508,10 @@ RISCVTTIImpl::enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const {
25082508
Options.LoadSizes = {4, 2, 1};
25092509
if (IsZeroCmp && ST->hasVInstructions()) {
25102510
unsigned VLenB = ST->getRealMinVLen() / 8;
2511-
for (unsigned Size = ST->getXLen() / 8 + 1;
2511+
// The minimum size should be the maximum bytes between `VLen * LMUL_MF8`
2512+
// and `XLen + 8`.
2513+
unsigned MinSize = std::max(VLenB / 8, ST->getXLen() / 8 + 1);
2514+
for (unsigned Size = MinSize;
25122515
Size <= VLenB * ST->getMaxLMULForFixedLengthVectors(); Size++)
25132516
Options.LoadSizes.insert(Options.LoadSizes.begin(), Size);
25142517
}

0 commit comments

Comments
 (0)