diff options
author | Eli Friedman <efriedma@codeaurora.org> | 2017-03-02 00:08:50 +0000 |
---|---|---|
committer | Eli Friedman <efriedma@codeaurora.org> | 2017-03-02 00:08:50 +0000 |
commit | 933863ce61f65749b5954e38b9881ff1a3d3c0ee (patch) | |
tree | 8dee6aebd2a0d63a88e21ea252294deca4d6593e /llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp | |
parent | 3bc714b2094b9234de81cd79b89beb99b453ed3b (diff) | |
download | llvm-933863ce61f65749b5954e38b9881ff1a3d3c0ee.zip llvm-933863ce61f65749b5954e38b9881ff1a3d3c0ee.tar.gz llvm-933863ce61f65749b5954e38b9881ff1a3d3c0ee.tar.bz2 |
Revert r296708; causing test failures on ARM hosts.
Original commit message:
[ARM] Fix insert point for store rescheduling.
In ARMPreAllocLoadStoreOpt::RescheduleOps, LastOp should be the last
operation which we want to merge. If we break out of the loop because
an operation has the wrong offset, we shouldn't use that operation as
LastOp.
This patch fixes some cases where we would sink stores for no reason.
llvm-svn: 296718
Diffstat (limited to 'llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp b/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp index 3afadab..f9eec7d 100644 --- a/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp +++ b/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp @@ -2161,39 +2161,33 @@ bool ARMPreAllocLoadStoreOpt::RescheduleOps(MachineBasicBlock *MBB, unsigned LastBytes = 0; unsigned NumMove = 0; for (int i = Ops.size() - 1; i >= 0; --i) { - // Make sure each operation has the same kind. MachineInstr *Op = Ops[i]; + unsigned Loc = MI2LocMap[Op]; + if (Loc <= FirstLoc) { + FirstLoc = Loc; + FirstOp = Op; + } + if (Loc >= LastLoc) { + LastLoc = Loc; + LastOp = Op; + } + unsigned LSMOpcode = getLoadStoreMultipleOpcode(Op->getOpcode(), ARM_AM::ia); if (LastOpcode && LSMOpcode != LastOpcode) break; - // Check that we have a continuous set of offsets. int Offset = getMemoryOpOffset(*Op); unsigned Bytes = getLSMultipleTransferSize(Op); if (LastBytes) { if (Bytes != LastBytes || Offset != (LastOffset + (int)Bytes)) break; } - - // Don't try to reschedule too many instructions. - if (++NumMove == 8) // FIXME: Tune this limit. - break; - - // Found a mergable instruction; save information about it. LastOffset = Offset; LastBytes = Bytes; LastOpcode = LSMOpcode; - - unsigned Loc = MI2LocMap[Op]; - if (Loc <= FirstLoc) { - FirstLoc = Loc; - FirstOp = Op; - } - if (Loc >= LastLoc) { - LastLoc = Loc; - LastOp = Op; - } + if (++NumMove == 8) // FIXME: Tune this limit. + break; } if (NumMove <= 1) |