[llvm] [AArch64] merge index address with large offset into base address (PR #75343)

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 20 00:47:06 PST 2023


================
@@ -2220,6 +2395,60 @@ MachineBasicBlock::iterator AArch64LoadStoreOpt::findMatchingUpdateInsnBackward(
   return E;
 }
 
+MachineBasicBlock::iterator
+AArch64LoadStoreOpt::findMatchingConstOffsetBackward(
+    MachineBasicBlock::iterator I, unsigned Limit, unsigned &Offset) {
+  MachineBasicBlock::iterator B = I->getParent()->begin();
+  MachineBasicBlock::iterator E = I->getParent()->end();
+  MachineInstr &MemMI = *I;
+  MachineBasicBlock::iterator MBBI = I;
+
+  // If the load is the first instruction in the block, there's obviously
+  // not any matching load or store.
+  if (MBBI == B)
+    return E;
+
+  // Make sure the IndexReg is killed and the shift amount is zero.
+  // TODO: Relex this restriction to extend, simplify processing now.
+  if (!AArch64InstrInfo::getLdStOffsetOp(MemMI).isKill() ||
----------------
vfdff wrote:

yes, because we'll delete these old instructions when we math the folding in the end of function **mergeConstOffsetInsn**. 

https://github.com/llvm/llvm-project/pull/75343


More information about the llvm-commits mailing list