Update alignment on local variables.
authorhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 14 Apr 2011 17:10:24 +0000 (17:10 +0000)
committerhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 14 Apr 2011 17:10:24 +0000 (17:10 +0000)
2011-04-14  H.J. Lu  <hongjiu.lu@intel.com>

PR middle-end/48608
* cfgexpand.c (get_decl_align_unit): Renamed to ...
(align_local_variable): This.  Update DECL_ALIGN.
(add_stack_var): Updated.
(expand_one_stack_var): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172438 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cfgexpand.c

index bf936e8..97c08fc 100644 (file)
@@ -1,3 +1,11 @@
+2011-04-14  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR middle-end/48608
+       * cfgexpand.c (get_decl_align_unit): Renamed to ...
+       (align_local_variable): This.  Update DECL_ALIGN.
+       (add_stack_var): Updated.
+       (expand_one_stack_var): Likewise.
+
 2011-04-14  Richard Guenther  <rguenther@suse.de>
 
        * tree-ssa-dse.c (struct dse_global_data, struct dse_block_local_data):
index cc1382f..d84c57e 100644 (file)
@@ -205,13 +205,14 @@ static bool has_protected_decls;
    smaller than our cutoff threshold.  Used for -Wstack-protector.  */
 static bool has_short_buffer;
 
-/* Discover the byte alignment to use for DECL.  Ignore alignment
+/* Compute the byte alignment to use for DECL.  Ignore alignment
    we can't do with expected alignment of the stack boundary.  */
 
 static unsigned int
-get_decl_align_unit (tree decl)
+align_local_variable (tree decl)
 {
   unsigned int align = LOCAL_DECL_ALIGNMENT (decl);
+  DECL_ALIGN (decl) = align;
   return align / BITS_PER_UNIT;
 }
 
@@ -273,7 +274,7 @@ add_stack_var (tree decl)
      variables that are simultaneously live.  */
   if (v->size == 0)
     v->size = 1;
-  v->alignb = get_decl_align_unit (SSAVAR (decl));
+  v->alignb = align_local_variable (SSAVAR (decl));
 
   /* All variables are initially in their own partition.  */
   v->representative = stack_vars_num;
@@ -905,7 +906,7 @@ expand_one_stack_var (tree var)
   unsigned byte_align;
 
   size = tree_low_cst (DECL_SIZE_UNIT (SSAVAR (var)), 1);
-  byte_align = get_decl_align_unit (SSAVAR (var));
+  byte_align = align_local_variable (SSAVAR (var));
 
   /* We handle highly aligned variables in expand_stack_vars.  */
   gcc_assert (byte_align * BITS_PER_UNIT <= MAX_SUPPORTED_STACK_ALIGNMENT);