https://gcc.gnu.org/g:d213bc5e67d903143608e0a7879c2577c33ca47e

commit d213bc5e67d903143608e0a7879c2577c33ca47e
Author: Michael Matz <m...@suse.de>
Date:   Tue Jul 9 06:01:47 2024 +0200

    x86-ssw: precise using of moves
    
    we need to differ between merely not wanting to use moves
    and not being able to.  When the allocated frame is too
    large we can't use moves freely and hence need to disable
    separate shrink wrapping.  If we don't want to use moves
    by default for speed or the like but nothing else prevents
    them then this is no reason to disable separate shrink wrapping.

Diff:
---
 gcc/config/i386/i386.cc | 20 +++++++++++---------
 gcc/config/i386/i386.h  |  1 +
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 23226d204a09..20f4dcd61870 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -7120,9 +7120,7 @@ ix86_compute_frame_layout (void)
   /* Size prologue needs to allocate.  */
   to_allocate = offset - frame->sse_reg_save_offset;
 
-  if ((!to_allocate && frame->nregs <= 1
-       /*&& !flag_shrink_wrap_separate*/)
-      || (TARGET_64BIT && to_allocate >= HOST_WIDE_INT_C (0x80000000))
+  if ((TARGET_64BIT && to_allocate >= HOST_WIDE_INT_C (0x80000000))
        /* If static stack checking is enabled and done with probes,
          the registers need to be saved before allocating the frame.  */
       || flag_stack_check == STATIC_BUILTIN_STACK_CHECK
@@ -7135,6 +7133,12 @@ ix86_compute_frame_layout (void)
       || (flag_stack_clash_protection
          && !ix86_target_stack_probe ()
          && to_allocate > get_probe_interval ()))
+    {
+      frame->cannot_use_moves = true;
+    }
+
+  if ((!to_allocate && frame->nregs <= 1)
+      || frame->cannot_use_moves)
     frame->save_regs_using_mov = false;
 
   if (ix86_using_red_zone ()
@@ -10800,13 +10804,13 @@ separate_frame_alloc_p (void)
 static sbitmap
 ix86_get_separate_components (void)
 {
-  //struct machine_function *m = cfun->machine;
-  //struct ix86_frame *frame = &m->frame;
+  struct machine_function *m = cfun->machine;
+  struct ix86_frame *frame = &m->frame;
   sbitmap components;
 
   ix86_finalize_stack_frame_flags ();
-  if (/*!frame->save_regs_using_mov
-      ||*/ crtl->drap_reg
+  if (frame->cannot_use_moves
+      || crtl->drap_reg
       || cfun->machine->func_type != TYPE_NORMAL)
     return NULL;
 
@@ -10868,9 +10872,7 @@ ix86_components_for_bb (basic_block bb)
            {
              need_frame = true;
              break;
-
            }
-
        }
     }
   if (need_frame)
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index dd73687a8e2c..bda3d97ab4cf 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2645,6 +2645,7 @@ struct GTY(()) ix86_frame
   /* When save_regs_using_mov is set, emit prologue using
      move instead of push instructions.  */
   bool save_regs_using_mov;
+  bool cannot_use_moves;
 
   /* Assume without checking that:
        EXPENSIVE_P = expensive_function_p (EXPENSIVE_COUNT).  */

Reply via email to