[llvm] [AArch64] Minor aarch64-ldst-opt simplification (PR #207182)
Ömer Sinan Ağacan via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 2 06:12:13 PDT 2026
https://github.com/osa1 created https://github.com/llvm/llvm-project/pull/207182
Remove the local `MBBIWithRenameReg` by moving an early return at an
even earlier point.
When `MBBIWithRenameReg` is set we always return early. By moving the
early return to `MBBIWithRenameReg` update we get rid of a local
variable which spans 200+ lines. This also fixes a misleading debug
print between `MBBIWithRenameReg` update and early return:
```
LLVM_DEBUG(dbgs() << "Unable to combine these instructions due to "
<< "interference in between, keep looking.\n");
```
This line shouldn't be printed when we set `MBBIWithRenameReg`, which is
fixed with this change.
>From 8adc6d33b8da5d8384dcf3f31ee6a7366d568c23 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= <omeragacan at gmail.com>
Date: Thu, 2 Jul 2026 13:58:01 +0100
Subject: [PATCH] [AArch64] Minor aarch64-ldst-opt simplification
Remove the local `MBBIWithRenameReg` by moving an early return at an
even earlier point.
When `MBBIWithRenameReg` is set we always return early. By moving the
early return to `MBBIWithRenameReg` update we get rid of a local
variable which spans 200+ lines. This also fixes a misleading debug
print between `MBBIWithRenameReg` update and early return:
```
LLVM_DEBUG(dbgs() << "Unable to combine these instructions due to "
<< "interference in between, keep looking.\n");
```
This line shouldn't be printed when we set `MBBIWithRenameReg`, which is
fixed with this change.
---
llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp b/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
index 0bca89815365f..bd0b603cfc06f 100644
--- a/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
+++ b/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
@@ -2017,7 +2017,6 @@ AArch64LoadStoreOpt::findMatchingInsn(MachineBasicBlock::iterator I,
bool FindNarrowMerge) {
MachineBasicBlock::iterator E = I->getParent()->end();
MachineBasicBlock::iterator MBBI = I;
- MachineBasicBlock::iterator MBBIWithRenameReg;
MachineInstr &FirstMI = *I;
MBBI = next_nodbg(MBBI, E);
@@ -2247,7 +2246,7 @@ AArch64LoadStoreOpt::findMatchingInsn(MachineBasicBlock::iterator I,
if (RenameReg) {
Flags.setMergeForward(true);
Flags.setRenameReg(*RenameReg);
- MBBIWithRenameReg = MBBI;
+ return MBBI;
}
}
LLVM_DEBUG(dbgs() << "Unable to combine these instructions due to "
@@ -2255,9 +2254,6 @@ AArch64LoadStoreOpt::findMatchingInsn(MachineBasicBlock::iterator I,
}
}
- if (Flags.getRenameReg())
- return MBBIWithRenameReg;
-
// If the instruction wasn't a matching load or store. Stop searching if we
// encounter a call instruction that might modify memory.
if (MI.isCall()) {
More information about the llvm-commits
mailing list