Skip to content

Commit dd629d5

Browse files
committed
Add CLI option to set the min count
1 parent 8d8b74f commit dd629d5

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ static cl::opt<unsigned> SLPMaxVF(
3737
"exclusively by SLP vectorizer."),
3838
cl::Hidden);
3939

40+
static cl::opt<unsigned>
41+
RVVMinTripCount("riscv-min-trip-count",
42+
cl::desc("Set the lower bound of a trip count to decide on "
43+
"vectorization while tail-folding."),
44+
cl::init(5), cl::Hidden);
45+
4046
InstructionCost
4147
RISCVTTIImpl::getRISCVInstructionCost(ArrayRef<unsigned> OpCodes, MVT VT,
4248
TTI::TargetCostKind CostKind) {
@@ -2598,6 +2604,10 @@ unsigned RISCVTTIImpl::getMaximumVF(unsigned ElemWidth, unsigned Opcode) const {
25982604
return std::max<unsigned>(1U, RegWidth.getFixedValue() / ElemWidth);
25992605
}
26002606

2607+
unsigned RISCVTTIImpl::getMinTripCountTailFoldingThreshold() const {
2608+
return RVVMinTripCount;
2609+
}
2610+
26012611
TTI::AddressingModeKind
26022612
RISCVTTIImpl::getPreferredAddressingMode(const Loop *L,
26032613
ScalarEvolution *SE) const {

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,7 @@ class RISCVTTIImpl : public BasicTTIImplBase<RISCVTTIImpl> {
388388

389389
bool enableInterleavedAccessVectorization() { return true; }
390390

391-
unsigned getMinTripCountTailFoldingThreshold() const {
392-
return ST->hasVInstructions() ? 5 : 0;
393-
}
391+
unsigned getMinTripCountTailFoldingThreshold() const;
394392

395393
enum RISCVRegisterClass { GPRRC, FPRRC, VRRC };
396394
unsigned getNumberOfRegisters(unsigned ClassID) const {

0 commit comments

Comments
 (0)