Skip to content

Commit bdf83f9

Browse files
committed
fixup: Format and add option for scan limit
1 parent d7f820b commit bdf83f9

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

llvm/lib/Target/RISCV/RISCVLoadStoreOptimizer.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ using namespace llvm;
4040

4141
#define DEBUG_TYPE "riscv-load-store-opt"
4242
#define RISCV_LOAD_STORE_OPT_NAME "RISC-V Load / Store Optimizer"
43+
44+
// The LdStLimit limits number of basic blocks how far we search for load/store
45+
// pairs.
46+
static cl::opt<unsigned> LdStLimit("riscv-load-store-scan-limit", cl::init(128),
47+
cl::Hidden);
48+
4349
namespace {
4450

4551
struct RISCVLoadStoreOpt : public MachineFunctionPass {
@@ -239,7 +245,7 @@ RISCVLoadStoreOpt::findMatchingInsn(MachineBasicBlock::iterator I,
239245
// Remember any instructions that read/write memory between FirstMI and MI.
240246
SmallVector<MachineInstr *, 4> MemInsns;
241247

242-
for (unsigned Count = 0; MBBI != E && Count < 128;
248+
for (unsigned Count = 0; MBBI != E && Count < LdStLimit;
243249
MBBI = next_nodbg(MBBI, E)) {
244250
MachineInstr &MI = *MBBI;
245251

llvm/lib/Target/RISCV/RISCVSubtarget.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ static cl::opt<bool> UseMIPSLoadStorePairsOpt(
6767
cl::desc("RISCV: Enable the load/store pair optimization pass"),
6868
cl::init(false), cl::Hidden);
6969

70-
static cl::opt<bool>
71-
UseMIPSLoadStoreBondingOpt("mips-riscv-load-store-bonding",
72-
cl::desc("RISCV: Optimize for load-store bonding"),
73-
cl::init(true), cl::Hidden);
70+
static cl::opt<bool> UseMIPSLoadStoreBondingOpt(
71+
"mips-riscv-load-store-bonding",
72+
cl::desc("RISCV: Optimize for load-store bonding"), cl::init(true),
73+
cl::Hidden);
7474

7575
static cl::opt<bool>
7676
UseCCMovInsn("riscv-ccmov", cl::desc("RISCV: Use 'mips.ccmov' instruction"),

0 commit comments

Comments
 (0)