> I'd say let's not have a middle ground - this stuff is sufficiently
> brain-twisting that I'd rather go back to a known working state. If
> there was an error in the previous patch, let's roll it back until we
> fully understand the situation.
Here's a revised version along these lines, OK for mainline after testing?
PR middle-end/78468
* emit-rtl.c (init_emit): Add ??? comment for problematic alignment
settings of the virtual registers.
Revert again
2016-08-23 Dominik Vogt <v...@linux.vnet.ibm.com>
* explow.c (get_dynamic_stack_size): Take known alignment of stack
pointer + STACK_DYNAMIC_OFFSET into account when calculating the size
needed.
--
Eric Botcazou
Index: emit-rtl.c
===================================================================
--- emit-rtl.c (revision 244917)
+++ emit-rtl.c (working copy)
@@ -5725,10 +5725,13 @@ init_emit (void)
REGNO_POINTER_ALIGN (HARD_FRAME_POINTER_REGNUM) = STACK_BOUNDARY;
REGNO_POINTER_ALIGN (ARG_POINTER_REGNUM) = STACK_BOUNDARY;
+ /* ??? These are problematic (for example, 3 out of 4 are wrong on
+ 32-bit SPARC and cannot be all fixed because of the ABI). */
REGNO_POINTER_ALIGN (VIRTUAL_INCOMING_ARGS_REGNUM) = STACK_BOUNDARY;
REGNO_POINTER_ALIGN (VIRTUAL_STACK_VARS_REGNUM) = STACK_BOUNDARY;
REGNO_POINTER_ALIGN (VIRTUAL_STACK_DYNAMIC_REGNUM) = STACK_BOUNDARY;
REGNO_POINTER_ALIGN (VIRTUAL_OUTGOING_ARGS_REGNUM) = STACK_BOUNDARY;
+
REGNO_POINTER_ALIGN (VIRTUAL_CFA_REGNUM) = BITS_PER_WORD;
#endif
Index: explow.c
===================================================================
--- explow.c (revision 244917)
+++ explow.c (working copy)
@@ -1233,15 +1233,9 @@ get_dynamic_stack_size (rtx *psize, unsi
example), so we must preventively align the value. We leave space
in SIZE for the hole that might result from the alignment operation. */
- unsigned known_align = REGNO_POINTER_ALIGN (VIRTUAL_STACK_DYNAMIC_REGNUM);
- if (known_align == 0)
- known_align = BITS_PER_UNIT;
- if (required_align > known_align)
- {
- extra = (required_align - known_align) / BITS_PER_UNIT;
- size = plus_constant (Pmode, size, extra);
- size = force_operand (size, NULL_RTX);
- }
+ extra = (required_align - BITS_PER_UNIT) / BITS_PER_UNIT;
+ size = plus_constant (Pmode, size, extra);
+ size = force_operand (size, NULL_RTX);
if (flag_stack_usage_info && pstack_usage_size)
*pstack_usage_size += extra;