This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix i?86 eh regressions (PR middle-end/40304)


On Sat, May 30, 2009 at 06:21:24AM -0700, H.J. Lu wrote:
> This breaks stack unwind on Linux/ia32:
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40304

The C++ regressions can be fixed by making sure the prologue
stack adjustment is again marked frame related.
The difference e.g. on async-unwind1.C between mainline before Richard's
changes and current trunk with this patch is just in a couple of additional
.cfi_* directives, while unpatched current trunk emits worse code
(csa pass doesn't merge insns that it should) and also DW_CFA_GNU_args_size
ops are wrong, because they shouldn't be changing on prologue insns, but
as the prologue stack adjust isn't marked frame related, they are off by 8.

lea.c regression seems to be unrelated, seems the presence of a frame
related insn later in the bb confuses following peepholing in the same bb.
peephole2_optimize does:
              if (RTX_FRAME_RELATED_P (insn))
                {
                  /* If an insn has RTX_FRAME_RELATED_P set, peephole
                     substitution would lose the
                     REG_FRAME_RELATED_EXPR that is attached.  */
                  peep2_current_count = 0;
                  attempt = NULL;
                }
and the clearing of peep2_current_count apparently affects even peepholing
of 2 insns earlier in the same bb.  I'm not familiar enough with peephole2
pass to understand why yet.

2009-05-30  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/40304
	* config/i386/i386.c (pro_epilogue_adjust_stack): Mark insns
	frame related even if !set_cfa && style < 0.

--- gcc/config/i386/i386.c.jj	2009-05-30 10:13:01.000000000 +0200
+++ gcc/config/i386/i386.c	2009-05-30 20:43:15.000000000 +0200
@@ -8026,6 +8026,8 @@ pro_epilogue_adjust_stack (rtx dest, rtx
       gcc_assert (style);
       r11 = gen_rtx_REG (DImode, R11_REG);
       insn = emit_insn (gen_rtx_SET (DImode, r11, offset));
+      if (style < 0)
+	RTX_FRAME_RELATED_P (insn) = 1;
       insn = emit_insn (gen_pro_epilogue_adjust_stack_rex64_2 (dest, src, r11,
 							       offset));
     }
@@ -8043,6 +8045,8 @@ pro_epilogue_adjust_stack (rtx dest, rtx
       add_reg_note (insn, REG_CFA_ADJUST_CFA, r);
       RTX_FRAME_RELATED_P (insn) = 1;
     }
+  else if (style < 0)
+    RTX_FRAME_RELATED_P (insn) = 1;
 }
 
 /* Find an available register to be used as dynamic realign argument


	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]