Bug fix on function epilog optimization (ARM backend)
authorOliver Stannard <oliver.stannard@linaro.org>
Tue, 3 Sep 2019 09:51:19 +0000 (09:51 +0000)
committerOliver Stannard <oliver.stannard@linaro.org>
Tue, 3 Sep 2019 09:51:19 +0000 (09:51 +0000)
commit39bf484d92b76a1ecf6b3787284e65477cfd8684
tree4b4aaaa458c557ef33d8455c30c10fdaa4614c80
parent855caf2335c0837666f8174d79e4df48b40dcb12
Bug fix on function epilog optimization (ARM backend)

To save a 'add sp,#val' instruction by adding registers to the final pop instruction,
the first register transferred by this pop instruction need to be found.
If the function to be optimized has a non-void return value, the operand list contains
r0 (implicit) which prevents the optimization to take place.
Therefore implicit register references should be skipped in the search loop,
because this registers are never popped from the stack.

Patch by Rainer Herbertz (rOptimizer)!

Differential revision: https://reviews.llvm.org/D66730

llvm-svn: 370728
llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
llvm/test/CodeGen/ARM/fold-stack-adjust.ll