Skip to content

Commit c8580ec

Browse files
PhilippvKNandniJamnadas
authored andcommitted
[RISCV] Use heuristic getPreferredAddressingMode
See https://reviews.llvm.org/D96600 for details
1 parent 292d34c commit c8580ec

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,15 @@ bool RISCVTTIImpl::shouldFavorPostInc() const {
10121012
return ST->hasExtXcvmem();
10131013
}
10141014

1015+
TTI::AddressingModeKind
1016+
RISCVTTIImpl::getPreferredAddressingMode(const Loop *L,
1017+
ScalarEvolution *SE) const {
1018+
if (ST->hasExtXcvmem())
1019+
return TTI::AMK_PostIndexed;
1020+
1021+
return TTI::AMK_None;
1022+
}
1023+
10151024
bool RISCVTTIImpl::isHardwareLoopProfitable(Loop *L, ScalarEvolution &SE,
10161025
AssumptionCache &AC,
10171026
TargetLibraryInfo *LibInfo,

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,11 @@ class RISCVTTIImpl : public BasicTTIImplBase<RISCVTTIImpl> {
308308
}
309309
llvm_unreachable("unknown register class");
310310
}
311-
311+
312312
bool shouldFavorPostInc() const;
313+
TTI::AddressingModeKind
314+
getPreferredAddressingMode(const Loop *L, ScalarEvolution *SE) const;
315+
313316
bool isHardwareLoopProfitable(Loop *L, ScalarEvolution &SE,
314317
AssumptionCache &AC,
315318
TargetLibraryInfo *LibInfo,

0 commit comments

Comments
 (0)