66//
77// ===----------------------------------------------------------------------===//
88//
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.
2013//
2114// 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 .
2821//
2922// ===----------------------------------------------------------------------===//
3023
@@ -90,7 +83,6 @@ struct RISCVLoadStoreOpt : public MachineFunctionPass {
9083 const RISCVRegisterInfo *TRI;
9184 LiveRegUnits ModifiedRegUnits, UsedRegUnits;
9285 bool EnableLoadStorePairs = false ;
93- bool EnableLoadStoreBonding = false ;
9486};
9587} // end anonymous namespace
9688
@@ -103,8 +95,7 @@ bool RISCVLoadStoreOpt::runOnMachineFunction(MachineFunction &Fn) {
10395 return false ;
10496 const RISCVSubtarget &Subtarget = Fn.getSubtarget <RISCVSubtarget>();
10597 EnableLoadStorePairs = Subtarget.useLoadStorePairs ();
106- EnableLoadStoreBonding = Subtarget.useMIPSLoadStoreBonding ();
107- if (!EnableLoadStorePairs && !EnableLoadStoreBonding)
98+ if (!EnableLoadStorePairs)
10899 return false ;
109100
110101 bool MadeChange = false ;
@@ -379,19 +370,9 @@ RISCVLoadStoreOpt::mergePairedInsns(MachineBasicBlock::iterator I,
379370 First = InsertionPoint;
380371 }
381372
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.
387373 if (EnableLoadStorePairs && tryConvertToLdStPair (First, Second)) {
388374 LLVM_DEBUG (dbgs () << " Pairing load/store:\n " );
389375 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 ()));
395376 }
396377
397378 return NextI;
0 commit comments