Patchwork [lra] patch to fix s390 testsuite failures

login
register
mail settings
Submitter Vladimir Makarov
Date March 15, 2013, 10:51 p.m.
Message ID <5143A5DE.1080004@redhat.com>
Download mbox | patch
Permalink /patch/228191/
State New
Headers show

Comments

Vladimir Makarov - March 15, 2013, 10:51 p.m.
The following patch fixes all s390 GCC testsuite failures (in comparison 
with reloads).  The problem was in unaligned access in a shared library 
code which was result of unaligned stack of generated code.

The patch was also successfully bootstrapped on x86/x86-64.

Committed as rev. 196685.

2013-03-15  Vladimir Makarov <vmakarov@redhat.com>

         * lra.c (lra): Align non-empty stack frame.
         * lra-spills.c (lra_spill): Align stack after spilling pseudos.

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 196598)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@ 
+2013-03-15  Vladimir Makarov  <vmakarov@redhat.com>
+
+	* lra.c (lra): Allign non-empty stack frame.
+	* lra-spills.c (lra_spill): Allign stack after spilling pseudos.
+
 2013-03-08  Vladimir Makarov  <vmakarov@redhat.com>
 
 	* lra-constraints.c (process_alt_operands): Don't penalize
Index: lra-spills.c
===================================================================
--- lra-spills.c	(revision 196598)
+++ lra-spills.c	(working copy)
@@ -548,6 +548,11 @@  lra_spill (void)
   for (i = 0; i < n; i++)
     if (pseudo_slots[pseudo_regnos[i]].mem == NULL_RTX)
       assign_mem_slot (pseudo_regnos[i]);
+  if (n > 0 && crtl->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.  */
+    assign_stack_local (BLKmode, 0, crtl->stack_alignment_needed);
   if (lra_dump_file != NULL)
     {
       for (i = 0; i < slots_num; i++)
Index: lra.c
===================================================================
--- lra.c	(revision 196598)
+++ lra.c	(working copy)
@@ -2272,6 +2272,11 @@  lra (FILE *f)
   bitmap_initialize (&lra_split_regs, &reg_obstack);
   bitmap_initialize (&lra_optional_reload_pseudos, &reg_obstack);
   live_p = false;
+  if (get_frame_size () != 0 && crtl->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.  */
+    assign_stack_local (BLKmode, 0, crtl->stack_alignment_needed);
   for (;;)
     {
       for (;;)