From 6f19785029f4aa8cf9f78fbd9bd446ba990f4a78 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 14 Apr 2011 17:10:24 +0000 Subject: [PATCH] Update alignment on local variables. 2011-04-14 H.J. Lu 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. From-SVN: r172438 --- gcc/ChangeLog | 8 ++++++++ gcc/cfgexpand.c | 9 +++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bf936e8178e..97c08fc140a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2011-04-14 H.J. Lu + + 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 * tree-ssa-dse.c (struct dse_global_data, struct dse_block_local_data): diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index cc1382fa4df..d84c57eb7f9 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -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); -- 2.30.2