aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2006-12-21 09:03:18 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2006-12-21 09:03:18 +0000
commit970af8677126773a729c5fde809ab307b6494082 (patch)
treed16ac4c285b07d9272716d077f44f7d69f5968b5 /gcc
parenta957d77fc36e52b459a42043b8ea9cadab574277 (diff)
downloadgcc-970af8677126773a729c5fde809ab307b6494082.zip
gcc-970af8677126773a729c5fde809ab307b6494082.tar.gz
gcc-970af8677126773a729c5fde809ab307b6494082.tar.bz2
re PR target/28966 (-maltivec -m32 causes the stack to be saved and restored even though there is no need for it)
gcc/ PR target/28966 PR target/29248 * reload1.c (reload): Realign stack after it changes size. gcc/testsuite/ PR target/28966 PR target/29248 * gcc.dg/rs6000-leaf.c: New. From-SVN: r120102
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/reload1.c22
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/rs6000-leaf.c8
4 files changed, 34 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 40f7c77..2e3f9d9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2006-12-21 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR target/28966
+ PR target/29248
+ * reload1.c (reload): Realign stack after it changes size.
+
2006-12-20 Roger Sayle <roger@eyesopen.com>
* simplify-rtx.c (simplify_subreg): Use the correct mode when
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 4543835..efa1a39 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -888,16 +888,8 @@ reload (rtx first, int global)
{
int something_changed;
int did_spill;
-
HOST_WIDE_INT starting_frame_size;
- /* Round size of stack frame to stack_alignment_needed. This must be done
- here because the stack size may be a part of the offset computation
- for register elimination, and there might have been new stack slots
- created in the last iteration of this loop. */
- if (cfun->stack_alignment_needed)
- assign_stack_local (BLKmode, 0, cfun->stack_alignment_needed);
-
starting_frame_size = get_frame_size ();
set_initial_elim_offsets ();
@@ -964,6 +956,20 @@ reload (rtx first, int global)
/* If we allocated another stack slot, redo elimination bookkeeping. */
if (starting_frame_size != get_frame_size ())
continue;
+ if (starting_frame_size && cfun->stack_alignment_needed)
+ {
+ /* If we have a stack frame, we must align it now. The
+ stack size may be a part of the offset computation for
+ register elimination. So if this changes the stack size,
+ then repeat the elimination bookkeeping. We don't
+ realign when there is no stack, as that will cause a
+ stack frame when none is needed should
+ STARTING_FRAME_OFFSET not be already aligned to
+ STACK_BOUNDARY. */
+ assign_stack_local (BLKmode, 0, cfun->stack_alignment_needed);
+ if (starting_frame_size != get_frame_size ())
+ continue;
+ }
if (caller_save_needed)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a1e84b1..d708742 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2006-12-21 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR target/28966
+ PR target/29248
+ * gcc.dg/rs6000-leaf.c: New.
+
2006-12-20 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/25392
diff --git a/gcc/testsuite/gcc.dg/rs6000-leaf.c b/gcc/testsuite/gcc.dg/rs6000-leaf.c
new file mode 100644
index 0000000..0794189
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/rs6000-leaf.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target rs6000-*-* } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tstwu 1,-\[0-9\]*(1)\n" } } */
+
+int Leaf (int i)
+{
+ return i + 1;
+}