[gcc r13-7801] aarch64: Only calculate chain_offset if there is a chain

Richard Sandiford rsandifo@gcc.gnu.org
Tue Sep 12 15:08:35 GMT 2023


https://gcc.gnu.org/g:8ae9181426f2700c2e5a2909487fa630e6fa406b

commit r13-7801-g8ae9181426f2700c2e5a2909487fa630e6fa406b
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Tue Sep 12 16:07:15 2023 +0100

    aarch64: Only calculate chain_offset if there is a chain
    
    After previous patches, it is no longer necessary to calculate
    a chain_offset in cases where there is no chain record.
    
    gcc/
            * config/aarch64/aarch64.cc (aarch64_expand_prologue): Move the
            calculation of chain_offset into the emit_frame_chain block.

Diff:
---
 gcc/config/aarch64/aarch64.cc | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 46ae5cf76735..0e9b9717c085 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -10062,16 +10062,16 @@ aarch64_expand_prologue (void)
   if (callee_adjust != 0)
     aarch64_push_regs (reg1, reg2, callee_adjust);
 
-  /* The offset of the frame chain record (if any) from the current SP.  */
-  poly_int64 chain_offset = (initial_adjust + callee_adjust
-			     - frame.hard_fp_offset);
-  gcc_assert (known_ge (chain_offset, 0));
-
   /* The offset of the current SP from the bottom of the static frame.  */
   poly_int64 bytes_below_sp = frame_size - initial_adjust - callee_adjust;
 
   if (emit_frame_chain)
     {
+      /* The offset of the frame chain record (if any) from the current SP.  */
+      poly_int64 chain_offset = (initial_adjust + callee_adjust
+				 - frame.hard_fp_offset);
+      gcc_assert (known_ge (chain_offset, 0));
+
       if (callee_adjust == 0)
 	{
 	  reg1 = R29_REGNUM;


More information about the Gcc-cvs mailing list