[llvm] r260274 - [AArch64] Bail even earlier if the instructions modifieds the base register. NFC.
Chad Rosier via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 9 12:44:42 PST 2016
Author: mcrosier
Date: Tue Feb 9 14:44:41 2016
New Revision: 260274
URL: http://llvm.org/viewvc/llvm-project?rev=260274&view=rev
Log:
[AArch64] Bail even earlier if the instructions modifieds the base register. NFC.
Modified:
llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
Modified: llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp?rev=260274&r1=260273&r2=260274&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Tue Feb 9 14:44:41 2016
@@ -1151,11 +1151,6 @@ AArch64LoadStoreOpt::findMatchingInsn(Ma
if (IsNarrowStore && Reg != AArch64::WZR)
return E;
- // Early exit if the first instruction modifies the base register.
- // e.g., ldr x0, [x0]
- if (FirstMI->modifiesRegister(BaseReg, TRI))
- return E;
-
// Early exit if the offset is not possible to match. (6 bits of positive
// range, plus allow an extra one in case we find a later insn that matches
// with Offset-1)
@@ -1560,6 +1555,12 @@ bool AArch64LoadStoreOpt::isCandidateToM
if (!getLdStOffsetOp(MI).isImm())
return false;
+ // Can't merge/pair if the instruction modifies the base register.
+ // e.g., ldr x0, [x0]
+ unsigned BaseReg = getLdStBaseOp(MI).getReg();
+ if (MI->modifiesRegister(BaseReg, TRI))
+ return false;
+
// Check if this load/store has a hint to avoid pair formation.
// MachineMemOperands hints are set by the AArch64StorePairSuppress pass.
if (TII->isLdStPairSuppressed(MI))
More information about the llvm-commits
mailing list