aarch64: Fix missed shrink-wrapping opportunity
wb_candidate1 and wb_candidate2 exist for two overlapping cases:
when we use an STR or STP with writeback to allocate the frame,
and when we set up a frame chain record (either using writeback
allocation or not).
However, aarch64_layout_frame was leaving these fields with
legitimate register numbers even if we decided to do neither
of those things. This prevented those registers from being
shrink-wrapped, even though we were otherwise treating them
as normal saves and restores.
The case this patch handles isn't the common case, so it might
not be worth going out of our way to optimise it. But I think
the patch actually makes the output of aarch64_layout_frame more
consistent.
2020-05-28 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* config/aarch64/aarch64.h (aarch64_frame): Add a comment above
wb_candidate1 and wb_candidate2.
* config/aarch64/aarch64.c (aarch64_layout_frame): Invalidate
wb_candidate1 and wb_candidate2 if we decided not to use them.
gcc/testsuite/
* gcc.target/aarch64/shrink_wrap_1.c: New test.