Patchwork Fix PR middle-end/46894

login
register
mail settings
Submitter Eric Botcazou
Date Jan. 18, 2011, 9:26 p.m.
Message ID <201101182226.59585.ebotcazou@adacore.com>
Download mbox | patch
Permalink /patch/79363/
State New
Headers show

Comments

Eric Botcazou - Jan. 18, 2011, 9:26 p.m.
> Here's my proposal: let's fix the regression by applying my original patch
> and open a new PR with Richard's patch attached and 4.7 as target
> milestone.

I've installed the attached patch after bootstrap/regtest on x86_64-suse-linux 
and opened PR middle-end/47353 to track the S_P_O pessimization.

Patch

Index: explow.c
===================================================================
--- explow.c	(revision 168903)
+++ explow.c	(working copy)
@@ -1148,6 +1148,7 @@  allocate_dynamic_stack_space (rtx size,
 {
   HOST_WIDE_INT stack_usage_size = -1;
   rtx final_label, final_target, target;
+  unsigned extra_align = 0;
   bool must_align;
 
   /* If we're asking for zero bytes, it doesn't matter what we point
@@ -1231,21 +1232,25 @@  allocate_dynamic_stack_space (rtx size,
      that might result from the alignment operation.  */
 
   must_align = (crtl->preferred_stack_boundary < required_align);
-#if defined (STACK_DYNAMIC_OFFSET) || defined (STACK_POINTER_OFFSET)
-  must_align = true;
-#endif
-
   if (must_align)
     {
-      unsigned extra, extra_align;
-
       if (required_align > PREFERRED_STACK_BOUNDARY)
 	extra_align = PREFERRED_STACK_BOUNDARY;
       else if (required_align > STACK_BOUNDARY)
 	extra_align = STACK_BOUNDARY;
       else
 	extra_align = BITS_PER_UNIT;
-      extra = (required_align - extra_align) / BITS_PER_UNIT;
+    }
+
+  /* ??? STACK_POINTER_OFFSET is always defined now.  */
+#if defined (STACK_DYNAMIC_OFFSET) || defined (STACK_POINTER_OFFSET)
+  must_align = true;
+  extra_align = BITS_PER_UNIT;
+#endif
+
+  if (must_align)
+    {
+      unsigned extra = (required_align - extra_align) / BITS_PER_UNIT;
 
       size = plus_constant (size, extra);
       size = force_operand (size, NULL_RTX);