@@ -11164,9 +11164,14 @@ ix86_compute_frame_layout (void)
unsigned HOST_WIDE_INT stack_alignment_needed;
HOST_WIDE_INT offset;
unsigned HOST_WIDE_INT preferred_alignment;
- HOST_WIDE_INT size = get_frame_size ();
+ HOST_WIDE_INT size;
HOST_WIDE_INT to_allocate;
+ if (cfun->machine->no_stack_frame)
+ size = HOST_WIDE_INT_C (0);
+ else
+ size = get_frame_size ();
+
/* m->call_ms2sysv is initially enabled in ix86_expand_call for all 64-bit
* ms_abi functions that call a sysv function. We now need to prune away
* cases where it should be disabled. */
@@ -12830,6 +12835,9 @@ ix86_find_max_used_stack_alignment (unsigned int &stack_alignment,
}
}
+ if (!require_stack_frame)
+ cfun->machine->no_stack_frame = 1;
+
return require_stack_frame;
}
@@ -2754,6 +2754,9 @@ struct GTY(()) machine_function {
/* If true, ENDBR is queued at function entrance. */
BOOL_BITFIELD endbr_queued_at_entrance : 1;
+ /* Nonzero if the function doesn't need a stack frame. */
+ BOOL_BITFIELD no_stack_frame : 1;
+
/* The largest alignment, in bytes, of stack slot actually used. */
unsigned int max_used_stack_alignment;
new file mode 100644
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f" } */
+
+struct B
+{
+ char a[12];
+ int b;
+};
+
+struct B
+f2 (void)
+{
+ struct B x = {};
+ return x;
+}
+
+/* { dg-final { scan-assembler-not "(sub|add)(l|q)\[\\t \]*\\$\[0-9\]*,\[\\t \]*%\[re\]?sp" } } */