ARM: Fix and re-enable load/store optimizer for Thumb1.
authorMoritz Roth <moritz.roth@arm.com>
Fri, 15 Aug 2014 17:00:30 +0000 (17:00 +0000)
committerMoritz Roth <moritz.roth@arm.com>
Fri, 15 Aug 2014 17:00:30 +0000 (17:00 +0000)
commitd84561bf69132f7d1ab2775ef7f990fb5fb6905f
treefcbc81263e9a6eae074f8ff25c829f572803056a
parent713d9cbc3e4c3f0482b9849bbd50a7a78c15e86f
ARM: Fix and re-enable load/store optimizer for Thumb1.

In a previous iteration of the pass, we would try to compensate for
writeback by updating later instructions and/or inserting a SUBS to
reset the base register if necessary.
Since such a SUBS sets the condition flags it's not generally safe to do
this. For now, only merge LDR/STRs if there is no writeback to the base
register (LDM that loads into the base register) or the base register is
killed by one of the merged instructions. These cases are clear wins
both in terms of instruction count and performance.

Also add three new test cases, and update the existing ones accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215729 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMLoadStoreOptimizer.cpp
test/CodeGen/Thumb/2014-06-10-thumb1-ldst-opt-bug.ll
test/CodeGen/Thumb/dyn-stackalloc.ll
test/CodeGen/Thumb/ldm-merge-call.ll [new file with mode: 0644]
test/CodeGen/Thumb/ldm-merge-struct.ll [new file with mode: 0644]
test/CodeGen/Thumb/stm-merge.ll [new file with mode: 0644]
test/CodeGen/Thumb/thumb-ldm.ll
test/CodeGen/Thumb/thumb-memcpy-ldm-stm.ll