From 35d8be37ee5f4bc13bb3ee30b55c0c379e9a89a2 Mon Sep 17 00:00:00 2001 From: krebbel Date: Fri, 18 Nov 2016 14:44:54 +0000 Subject: [PATCH] Re-apply: Drop excess size used for run time allocated stack variables. The patch got reverted after hitting PR77359 which turned out to be a rs6000 backend problem. Reapplying after the PR got fixed. gcc/ChangeLog: 2016-11-18 Dominik Vogt Re-apply after PR bootstrap/77359 is fixed: 2016-08-23 Dominik Vogt * explow.c (get_dynamic_stack_size): Take known alignment of stack pointer + STACK_DYNAMIC_OFFSET into account when calculating the size needed. --This line, and those below, will be ignored-- M gcc/ChangeLog M gcc/explow.c git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242590 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/explow.c | 12 +++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 95506d39c0f..b3f2b7327f7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,14 @@ 2016-11-18 Dominik Vogt + Re-apply after PR bootstrap/77359 is fixed: + 2016-08-23 Dominik Vogt + + * explow.c (get_dynamic_stack_size): Take known alignment of stack + pointer + STACK_DYNAMIC_OFFSET into account when calculating the + size needed. + +2016-11-18 Dominik Vogt + PR bootstrap/77359 * config/rs6000/rs6000.c (rs6000_stack_info): Properly align local variables in functions calling alloca. Also update the ASCII diff --git a/gcc/explow.c b/gcc/explow.c index 75af333c1c3..6758cca87e7 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -1233,9 +1233,15 @@ get_dynamic_stack_size (rtx *psize, unsigned size_align, example), so we must preventively align the value. We leave space in SIZE for the hole that might result from the alignment operation. */ - extra = (required_align - BITS_PER_UNIT) / BITS_PER_UNIT; - size = plus_constant (Pmode, size, extra); - size = force_operand (size, NULL_RTX); + 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); + } if (flag_stack_usage_info && pstack_usage_size) *pstack_usage_size += extra; -- 2.11.4.GIT