Fix a bug in the Thumb1 ARM Load/Store optimizer
authorRenato Golin <renato.golin@linaro.org>
Tue, 10 Jun 2014 16:39:21 +0000 (16:39 +0000)
committerRenato Golin <renato.golin@linaro.org>
Tue, 10 Jun 2014 16:39:21 +0000 (16:39 +0000)
commit2d89932fb282cc339f1d959b031bf419d624f65a
treea757bebe921f73553aff1a693c3edbf40b2218e7
parent102d0f3e3f108fec94cf998e2b1bb2fcf50657c3
Fix a bug in the Thumb1 ARM Load/Store optimizer

Previously, the basic block was searched for future uses of the base register,
and if necessary any writeback to the base register was reset using a SUB
instruction (e.g. before calling a function) just before such a use. However,
this step happened *before* the merged LDM/STM instruction was built. So if
there was (e.g.) a function call directly after the not-yet-formed LDM/STM,
the pass would first insert a SUB instruction to reset the base register,
and then (at the same location, incorrectly) insert the LDM/STM itself.

This patch fixes PR19972. Patch by Moritz Roth.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210542 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMLoadStoreOptimizer.cpp
test/CodeGen/Thumb/2014-06-10-thumb1-ldst-opt-bug.ll [new file with mode: 0644]