diff options
author | Chad Rosier <mcrosier@codeaurora.org> | 2016-02-09 20:44:41 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@codeaurora.org> | 2016-02-09 20:44:41 +0000 |
commit | cc5d61f98e5a3d5eee7547188cb250b8f2080675 (patch) | |
tree | 932e80421629fd94658855a7922abe1f90d57518 | |
parent | 1c44c598dde6cded7b8d3a3dcbace67778bd33fd (diff) |
[AArch64] Bail even earlier if the instructions modifieds the base register. NFC.
llvm-svn: 260274
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp b/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp index f38dee98d8e8..a283bc93706b 100644 --- a/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp +++ b/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp @@ -1151,11 +1151,6 @@ AArch64LoadStoreOpt::findMatchingInsn(MachineBasicBlock::iterator I, 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::isCandidateToMergeOrPair(MachineInstr *MI) { 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)) |