diff mbox

Fix output_set_got vs. barrier_args_size (PR middle-end/45484, take 2)

Message ID 20100903094614.GZ1269@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Sept. 3, 2010, 9:46 a.m. UTC
On Thu, Sep 02, 2010 at 05:11:27PM -0700, Richard Henderson wrote:
> On 09/02/2010 02:40 PM, Jakub Jelinek wrote:
> >  	  rtx insn;
> >  	  start_sequence ();
> > -	  insn = emit_barrier ();
> > +	  insn = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, pc_rtx));
> >  	  end_sequence ();
> >  	  dwarf2out_frame_debug (insn, false);
> 
> Ug.  Wouldn't it be better simply to expose a dwarf2out routine
> that flushes the queue, without dancing around fake insns?

Like this?  Bootstrapped/regtested on x86_64-linux and i686-linux.

2010-09-02  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/45484
	* dwarf2out.c (flush_queued_reg_saves): Rename to...
	(dwarf2out_flush_queued_reg_saves): ... this.  No longer static.
	(dwarf2out_frame_debug_expr, dwarf2out_frame_debug): Adjust callers.
	* dwarf2out.h (dwarf2out_flush_queued_reg_saves): New prototype.
	* config/i386/i386.c (output_set_got): Call it.



	Jakub

Comments

Jack Howarth Sept. 3, 2010, 2:01 p.m. UTC | #1
On Fri, Sep 03, 2010 at 11:46:14AM +0200, Jakub Jelinek wrote:
> On Thu, Sep 02, 2010 at 05:11:27PM -0700, Richard Henderson wrote:
> > On 09/02/2010 02:40 PM, Jakub Jelinek wrote:
> > >  	  rtx insn;
> > >  	  start_sequence ();
> > > -	  insn = emit_barrier ();
> > > +	  insn = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, pc_rtx));
> > >  	  end_sequence ();
> > >  	  dwarf2out_frame_debug (insn, false);
> > 
> > Ug.  Wouldn't it be better simply to expose a dwarf2out routine
> > that flushes the queue, without dancing around fake insns?
> 
> Like this?  Bootstrapped/regtested on x86_64-linux and i686-linux.

Jakub,
   I can confirm that at r163660 on x86_64-apple-darwin10, which exhibits a high frequency of
failure for compiling sprintf-chk.c due to PR45484, the proposed alternative patch eliminates
these failures as well.
              Jack
> 
> 2010-09-02  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR middle-end/45484
> 	* dwarf2out.c (flush_queued_reg_saves): Rename to...
> 	(dwarf2out_flush_queued_reg_saves): ... this.  No longer static.
> 	(dwarf2out_frame_debug_expr, dwarf2out_frame_debug): Adjust callers.
> 	* dwarf2out.h (dwarf2out_flush_queued_reg_saves): New prototype.
> 	* config/i386/i386.c (output_set_got): Call it.
> 
> --- gcc/dwarf2out.c.jj	2010-09-02 20:48:05.000000000 +0200
> +++ gcc/dwarf2out.c	2010-09-03 09:02:53.060646349 +0200
> @@ -471,7 +471,6 @@ static void output_cfi (dw_cfi_ref, dw_f
>  static void output_cfi_directive (dw_cfi_ref);
>  static void output_call_frame_info (int);
>  static void dwarf2out_note_section_used (void);
> -static void flush_queued_reg_saves (void);
>  static bool clobbers_queued_reg_save (const_rtx);
>  static void dwarf2out_frame_debug_expr (rtx, const char *);
>  
> @@ -1712,8 +1711,8 @@ queue_reg_save (const char *label, rtx r
>  
>  /* Output all the entries in QUEUED_REG_SAVES.  */
>  
> -static void
> -flush_queued_reg_saves (void)
> +void
> +dwarf2out_flush_queued_reg_saves (void)
>  {
>    struct queued_reg_save *q;
>  
> @@ -2458,7 +2457,7 @@ dwarf2out_frame_debug_expr (rtx expr, co
>              {
>  	      /* We interpret reg_save differently with stack_realign set.
>  		 Thus we must flush whatever we have queued first.  */
> -	      flush_queued_reg_saves ();
> +	      dwarf2out_flush_queued_reg_saves ();
>  
>                gcc_assert (cfa_store.reg == REGNO (XEXP (src, 0)));
>                fde->stack_realign = 1;
> @@ -2705,7 +2704,7 @@ dwarf2out_frame_debug (rtx insn, bool af
>        size_t i;
>  
>        /* Flush any queued register saves.  */
> -      flush_queued_reg_saves ();
> +      dwarf2out_flush_queued_reg_saves ();
>  
>        /* Set up state for generating call frame debug info.  */
>        lookup_cfa (&cfa);
> @@ -2733,7 +2732,7 @@ dwarf2out_frame_debug (rtx insn, bool af
>      }
>  
>    if (!NONJUMP_INSN_P (insn) || clobbers_queued_reg_save (insn))
> -    flush_queued_reg_saves ();
> +    dwarf2out_flush_queued_reg_saves ();
>  
>    if (!RTX_FRAME_RELATED_P (insn))
>      {
> @@ -2841,7 +2840,7 @@ dwarf2out_frame_debug (rtx insn, bool af
>       We could probably check just once, here, but this is safer than
>       removing the check above.  */
>    if (clobbers_queued_reg_save (insn))
> -    flush_queued_reg_saves ();
> +    dwarf2out_flush_queued_reg_saves ();
>  }
>  
>  /* Determine if we need to save and restore CFI information around this
> --- gcc/dwarf2out.h.jj	2010-06-28 13:43:38.000000000 +0200
> +++ gcc/dwarf2out.h	2010-09-03 09:03:37.906440532 +0200
> @@ -22,6 +22,7 @@ extern void dwarf2out_decl (tree);
>  extern void dwarf2out_frame_debug (rtx, bool);
>  extern void dwarf2out_cfi_begin_epilogue (rtx);
>  extern void dwarf2out_frame_debug_restore_state (void);
> +extern void dwarf2out_flush_queued_reg_saves (void);
>  
>  extern void debug_dwarf (void);
>  struct die_struct;
> --- gcc/config/i386/i386.c.jj	2010-09-02 20:44:41.194458857 +0200
> +++ gcc/config/i386/i386.c	2010-09-03 09:04:22.728521383 +0200
> @@ -8119,13 +8119,7 @@ output_set_got (rtx dest, rtx label ATTR
>        /* Ensure all queued register saves are flushed before the
>  	 call.  */
>        if (dwarf2out_do_frame ())
> -	{
> -	  rtx insn;
> -	  start_sequence ();
> -	  insn = emit_barrier ();
> -	  end_sequence ();
> -	  dwarf2out_frame_debug (insn, false);
> -	}
> +	dwarf2out_flush_queued_reg_saves ();
>  #endif
>        xops[2] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (name));
>        xops[2] = gen_rtx_MEM (QImode, xops[2]);
> 
> 
> 	Jakub
Richard Henderson Sept. 3, 2010, 2:42 p.m. UTC | #2
On 09/03/2010 02:46 AM, Jakub Jelinek wrote:
> On Thu, Sep 02, 2010 at 05:11:27PM -0700, Richard Henderson wrote:
>> On 09/02/2010 02:40 PM, Jakub Jelinek wrote:
>>>  	  rtx insn;
>>>  	  start_sequence ();
>>> -	  insn = emit_barrier ();
>>> +	  insn = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, pc_rtx));
>>>  	  end_sequence ();
>>>  	  dwarf2out_frame_debug (insn, false);
>>
>> Ug.  Wouldn't it be better simply to expose a dwarf2out routine
>> that flushes the queue, without dancing around fake insns?
> 
> Like this?  Bootstrapped/regtested on x86_64-linux and i686-linux.
> 
> 2010-09-02  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR middle-end/45484
> 	* dwarf2out.c (flush_queued_reg_saves): Rename to...
> 	(dwarf2out_flush_queued_reg_saves): ... this.  No longer static.
> 	(dwarf2out_frame_debug_expr, dwarf2out_frame_debug): Adjust callers.
> 	* dwarf2out.h (dwarf2out_flush_queued_reg_saves): New prototype.
> 	* config/i386/i386.c (output_set_got): Call it.

Much better, thanks.  Patch is ok.


r~
diff mbox

Patch

--- gcc/dwarf2out.c.jj	2010-09-02 20:48:05.000000000 +0200
+++ gcc/dwarf2out.c	2010-09-03 09:02:53.060646349 +0200
@@ -471,7 +471,6 @@  static void output_cfi (dw_cfi_ref, dw_f
 static void output_cfi_directive (dw_cfi_ref);
 static void output_call_frame_info (int);
 static void dwarf2out_note_section_used (void);
-static void flush_queued_reg_saves (void);
 static bool clobbers_queued_reg_save (const_rtx);
 static void dwarf2out_frame_debug_expr (rtx, const char *);
 
@@ -1712,8 +1711,8 @@  queue_reg_save (const char *label, rtx r
 
 /* Output all the entries in QUEUED_REG_SAVES.  */
 
-static void
-flush_queued_reg_saves (void)
+void
+dwarf2out_flush_queued_reg_saves (void)
 {
   struct queued_reg_save *q;
 
@@ -2458,7 +2457,7 @@  dwarf2out_frame_debug_expr (rtx expr, co
             {
 	      /* We interpret reg_save differently with stack_realign set.
 		 Thus we must flush whatever we have queued first.  */
-	      flush_queued_reg_saves ();
+	      dwarf2out_flush_queued_reg_saves ();
 
               gcc_assert (cfa_store.reg == REGNO (XEXP (src, 0)));
               fde->stack_realign = 1;
@@ -2705,7 +2704,7 @@  dwarf2out_frame_debug (rtx insn, bool af
       size_t i;
 
       /* Flush any queued register saves.  */
-      flush_queued_reg_saves ();
+      dwarf2out_flush_queued_reg_saves ();
 
       /* Set up state for generating call frame debug info.  */
       lookup_cfa (&cfa);
@@ -2733,7 +2732,7 @@  dwarf2out_frame_debug (rtx insn, bool af
     }
 
   if (!NONJUMP_INSN_P (insn) || clobbers_queued_reg_save (insn))
-    flush_queued_reg_saves ();
+    dwarf2out_flush_queued_reg_saves ();
 
   if (!RTX_FRAME_RELATED_P (insn))
     {
@@ -2841,7 +2840,7 @@  dwarf2out_frame_debug (rtx insn, bool af
      We could probably check just once, here, but this is safer than
      removing the check above.  */
   if (clobbers_queued_reg_save (insn))
-    flush_queued_reg_saves ();
+    dwarf2out_flush_queued_reg_saves ();
 }
 
 /* Determine if we need to save and restore CFI information around this
--- gcc/dwarf2out.h.jj	2010-06-28 13:43:38.000000000 +0200
+++ gcc/dwarf2out.h	2010-09-03 09:03:37.906440532 +0200
@@ -22,6 +22,7 @@  extern void dwarf2out_decl (tree);
 extern void dwarf2out_frame_debug (rtx, bool);
 extern void dwarf2out_cfi_begin_epilogue (rtx);
 extern void dwarf2out_frame_debug_restore_state (void);
+extern void dwarf2out_flush_queued_reg_saves (void);
 
 extern void debug_dwarf (void);
 struct die_struct;
--- gcc/config/i386/i386.c.jj	2010-09-02 20:44:41.194458857 +0200
+++ gcc/config/i386/i386.c	2010-09-03 09:04:22.728521383 +0200
@@ -8119,13 +8119,7 @@  output_set_got (rtx dest, rtx label ATTR
       /* Ensure all queued register saves are flushed before the
 	 call.  */
       if (dwarf2out_do_frame ())
-	{
-	  rtx insn;
-	  start_sequence ();
-	  insn = emit_barrier ();
-	  end_sequence ();
-	  dwarf2out_frame_debug (insn, false);
-	}
+	dwarf2out_flush_queued_reg_saves ();
 #endif
       xops[2] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (name));
       xops[2] = gen_rtx_MEM (QImode, xops[2]);