]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/44542 (expand_one_stack_var_at may set DECL_ALIGN to a too high value)
authorJakub Jelinek <jakub@redhat.com>
Tue, 27 Jul 2010 17:54:32 +0000 (19:54 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 27 Jul 2010 17:54:32 +0000 (19:54 +0200)
PR target/44542
* cfgexpand.c (expand_one_stack_var_at): Limit align to maximum
of max_used_stack_slot_alignment and PREFERRED_STACK_BOUNDARY
instead of MAX_SUPPORTED_STACK_ALIGNMENT.
(expand_one_var): Don't consider DECL_ALIGN for variables for
which expand_one_stack_var_at has been already called.

From-SVN: r162582

gcc/ChangeLog
gcc/cfgexpand.c

index cd97a4a03a06aefa84a8b4380bc8adff13f742ad..043c4015134141b14156154b36e98565788107f0 100644 (file)
@@ -1,5 +1,12 @@
 2010-07-27  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/44542
+       * cfgexpand.c (expand_one_stack_var_at): Limit align to maximum
+       of max_used_stack_slot_alignment and PREFERRED_STACK_BOUNDARY
+       instead of MAX_SUPPORTED_STACK_ALIGNMENT.
+       (expand_one_var): Don't consider DECL_ALIGN for variables for
+       which expand_one_stack_var_at has been already called.
+
        PR testsuite/44701
        * doc/md.texi: Clarify m and es constraints on PowerPC and m and S
        constraints on IA-64.
index fef31905bd5c3bd92e67b9d1c15d77b33970c50d..bf1149f9560236d57ebee35904df3f245a4a8e55 100644 (file)
@@ -713,7 +713,7 @@ static void
 expand_one_stack_var_at (tree decl, HOST_WIDE_INT offset)
 {
   /* Alignment is unsigned.   */
-  unsigned HOST_WIDE_INT align;
+  unsigned HOST_WIDE_INT align, max_align;
   rtx x;
 
   /* If this fails, we've overflowed the stack frame.  Error nicely?  */
@@ -730,10 +730,10 @@ expand_one_stack_var_at (tree decl, HOST_WIDE_INT offset)
       offset -= frame_phase;
       align = offset & -offset;
       align *= BITS_PER_UNIT;
-      if (align == 0)
-       align = STACK_BOUNDARY;
-      else if (align > MAX_SUPPORTED_STACK_ALIGNMENT)
-       align = MAX_SUPPORTED_STACK_ALIGNMENT;
+      max_align = MAX (crtl->max_used_stack_slot_alignment,
+                      PREFERRED_STACK_BOUNDARY);
+      if (align == 0 || align > max_align)
+       align = max_align;
 
       DECL_ALIGN (decl) = align;
       DECL_USER_ALIGN (decl) = 0;
@@ -938,6 +938,13 @@ expand_one_var (tree var, bool toplevel, bool really_expand)
        align = MINIMUM_ALIGNMENT (TREE_TYPE (var),
                                   TYPE_MODE (TREE_TYPE (var)),
                                   TYPE_ALIGN (TREE_TYPE (var)));
+      else if (DECL_HAS_VALUE_EXPR_P (var)
+              || (DECL_RTL_SET_P (var) && MEM_P (DECL_RTL (var))))
+       /* Don't consider debug only variables with DECL_HAS_VALUE_EXPR_P set
+          or variables which were assigned a stack slot already by
+          expand_one_stack_var_at - in the latter case DECL_ALIGN has been
+          changed from the offset chosen to it.  */
+       align = crtl->stack_alignment_estimated;
       else
        align = MINIMUM_ALIGNMENT (var, DECL_MODE (var), DECL_ALIGN (var));