[ARM] Transform LDMs into writeback form to save code size
commitd5127f42734f9808ec9012def67674ea5d421efd
authorJames Molloy <james.molloy@arm.com>
Tue, 7 Jun 2016 11:47:24 +0000 (7 11:47 +0000)
committerJames Molloy <james.molloy@arm.com>
Tue, 7 Jun 2016 11:47:24 +0000 (7 11:47 +0000)
tree942be82dc5e00d94085b374c883a688c207e9f85
parentdf40105b527620804c78a6831147286578a77e61
[ARM] Transform LDMs into writeback form to save code size

If we have an LDM that uses only low registers and doesn't write to its base register:

  ldm.w r0, {r1, r2, r3}

And that base register is dead after the LDM, then we can convert it to writeback form and use a narrow encoding:

  ldm.n r0!, {r1, r2, r3}

Obviously, this introduces a new register write and so can cause WAW hazards, so I've enabled it only in minsize mode. This is a code size trick that ARM Compiler 5 ("armcc") does that we don't.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272000 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMLoadStoreOptimizer.cpp
test/CodeGen/ARM/ldm-base-writeback.ll [new file with mode: 0644]