]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: Only calculate chain_offset if there is a chain
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 12 Sep 2023 15:05:07 +0000 (16:05 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 12 Sep 2023 15:05:07 +0000 (16:05 +0100)
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.

gcc/config/aarch64/aarch64.cc

index 2c218c9090610d725dea6f56534e19dab0f19249..25b5fb243a6fa0930b6bf9a6f6e96a3956c96bef 100644 (file)
@@ -10111,16 +10111,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;