[llvm] r260275 - [AArch64] AArch64LoadStoreOptimizer: fix bug in pre-inc check iterator
Geoff Berry via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 9 12:47:22 PST 2016
Author: gberry
Date: Tue Feb 9 14:47:21 2016
New Revision: 260275
URL: http://llvm.org/viewvc/llvm-project?rev=260275&view=rev
Log:
[AArch64] AArch64LoadStoreOptimizer: fix bug in pre-inc check iterator
Summary:
Fix case where a pre-inc/dec load/store would not be formed if the
add/sub that forms the inc/dec part of the operation was the first
instruction in the block being examined.
Reviewers: mcrosier, jmolloy, t.p.northover, junbuml
Subscribers: aemerson, rengolin, mcrosier, llvm-commits
Differential Revision: http://reviews.llvm.org/D16785
Modified:
llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
llvm/trunk/test/CodeGen/AArch64/arm64-nvcast.ll
Modified: llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp?rev=260275&r1=260274&r2=260275&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Tue Feb 9 14:47:21 2016
@@ -1023,6 +1023,8 @@ static void trackRegDefsUses(const Machi
if (!MO.isReg())
continue;
unsigned Reg = MO.getReg();
+ if (!Reg)
+ continue;
if (MO.isDef()) {
for (MCRegAliasIterator AI(Reg, TRI, true); AI.isValid(); ++AI)
ModifiedRegs.set(*AI);
@@ -1496,15 +1498,14 @@ MachineBasicBlock::iterator AArch64LoadS
// (inclusive) and the second insn.
ModifiedRegs.reset();
UsedRegs.reset();
- --MBBI;
- for (unsigned Count = 0; MBBI != B && Count < Limit; --MBBI) {
+ unsigned Count = 0;
+ do {
+ --MBBI;
MachineInstr *MI = MBBI;
- // Skip DBG_VALUE instructions.
- if (MI->isDebugValue())
- continue;
- // Now that we know this is a real instruction, count it.
- ++Count;
+ // Don't count DBG_VALUE instructions towards the search limit.
+ if (!MI->isDebugValue())
+ ++Count;
// If we found a match, return it.
if (isMatchingUpdateInsn(I, MI, BaseReg, Offset))
@@ -1517,7 +1518,7 @@ MachineBasicBlock::iterator AArch64LoadS
// return early.
if (ModifiedRegs[BaseReg] || UsedRegs[BaseReg])
return E;
- }
+ } while (MBBI != B && Count < Limit);
return E;
}
Modified: llvm/trunk/test/CodeGen/AArch64/arm64-nvcast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/arm64-nvcast.ll?rev=260275&r1=260274&r2=260275&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/arm64-nvcast.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/arm64-nvcast.ll Tue Feb 9 14:47:21 2016
@@ -2,7 +2,7 @@
; CHECK-LABEL: _test:
; CHECK: fmov.2d v0, #2.00000000
-; CHECK: str q0, [sp]
+; CHECK: str q0, [sp, #-16]!
; CHECK: mov x8, sp
; CHECK: ldr s0, [x8, w1, sxtw #2]
; CHECK: str s0, [x0]
@@ -16,7 +16,7 @@ entry:
; CHECK-LABEL: _test2
; CHECK: movi.16b v0, #0x3f
-; CHECK: str q0, [sp]
+; CHECK: str q0, [sp, #-16]!
; CHECK: mov x8, sp
; CHECK: ldr s0, [x8, w1, sxtw #2]
; CHECK: str s0, [x0]
More information about the llvm-commits
mailing list