6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
8
//
9
- // This pass implements two key optimizations for RISC-V memory accesses:
10
- // 1. Load/Store Pairing: It identifies pairs of load or store instructions
11
- // operating on consecutive memory locations and merges them into a single
12
- // paired instruction, taking advantage of hardware support for paired
13
- // accesses. Much of the pairing logic is adapted from the
14
- // AArch64LoadStoreOpt pass.
15
- // 2. Load/Store Bonding: When direct pairing cannot be applied, the pass
16
- // bonds related memory instructions together into a bundle. This preserves
17
- // their proximity and prevents reordering that might violate memory
18
- // semantics. This technique benefits certain targets (e.g. MIPS P8700) by
19
- // ensuring that paired or bonded memory operations remain contiguous.
9
+ // Load/Store Pairing: It identifies pairs of load or store instructions
10
+ // operating on consecutive memory locations and merges them into a single
11
+ // paired instruction, leveraging hardware support for paired memory accesses.
12
+ // Much of the pairing logic is adapted from the AArch64LoadStoreOpt pass.
20
13
//
21
14
// NOTE: The AArch64LoadStoreOpt pass performs additional optimizations such as
22
- // merging zero store instructions, promoting loads that read directly
23
- // from a preceding store, and merging base register updates with
24
- // load/store instructions (via pre-/post-indexed addressing). These
25
- // advanced transformations are not yet implemented in the RISC-V pass but
26
- // represent potential future enhancements, as similar benefits could be
27
- // achieved on RISC-V architectures .
15
+ // merging zero store instructions, promoting loads that read directly from a
16
+ // preceding store, and merging base register updates with load/store
17
+ // instructions (via pre-/post-indexed addressing). These advanced
18
+ // transformations are not yet implemented in the RISC-V pass but represent
19
+ // potential future enhancements for further optimizing RISC-V memory
20
+ // operations .
28
21
//
29
22
// ===----------------------------------------------------------------------===//
30
23
@@ -90,7 +83,6 @@ struct RISCVLoadStoreOpt : public MachineFunctionPass {
90
83
const RISCVRegisterInfo *TRI;
91
84
LiveRegUnits ModifiedRegUnits, UsedRegUnits;
92
85
bool EnableLoadStorePairs = false ;
93
- bool EnableLoadStoreBonding = false ;
94
86
};
95
87
} // end anonymous namespace
96
88
@@ -103,8 +95,7 @@ bool RISCVLoadStoreOpt::runOnMachineFunction(MachineFunction &Fn) {
103
95
return false ;
104
96
const RISCVSubtarget &Subtarget = Fn.getSubtarget <RISCVSubtarget>();
105
97
EnableLoadStorePairs = Subtarget.useLoadStorePairs ();
106
- EnableLoadStoreBonding = Subtarget.useMIPSLoadStoreBonding ();
107
- if (!EnableLoadStorePairs && !EnableLoadStoreBonding)
98
+ if (!EnableLoadStorePairs)
108
99
return false ;
109
100
110
101
bool MadeChange = false ;
@@ -379,19 +370,9 @@ RISCVLoadStoreOpt::mergePairedInsns(MachineBasicBlock::iterator I,
379
370
First = InsertionPoint;
380
371
}
381
372
382
- // It may pair them or creaate bundles. The instructions may still be bundled
383
- // together, preserving their proximity and the intent of keeping related
384
- // memory accesses together. This bundling can help subsequent passes maintain
385
- // any implicit ordering or avoid reordering that might violate memory
386
- // semantics. For exmaple, MIPS P8700 benefits from it.
387
373
if (EnableLoadStorePairs && tryConvertToLdStPair (First, Second)) {
388
374
LLVM_DEBUG (dbgs () << " Pairing load/store:\n " );
389
375
LLVM_DEBUG (prev_nodbg (NextI, MBB.begin ())->print (dbgs ()));
390
- } else if (EnableLoadStoreBonding) {
391
- finalizeBundle (MBB, First.getInstrIterator (),
392
- std::next (Second).getInstrIterator ());
393
- LLVM_DEBUG (dbgs () << " Bonding load/store:\n " );
394
- LLVM_DEBUG (prev_nodbg (NextI, MBB.begin ())->print (dbgs ()));
395
376
}
396
377
397
378
return NextI;
0 commit comments