public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Do framep replacement even on RHS outside of MEM contexts (PR debug/44694)
@ 2010-06-29 15:29 Jakub Jelinek
  2010-06-29 15:46 ` Richard Guenther
  2010-07-01  8:13 ` Jie Zhang
  0 siblings, 2 replies; 8+ messages in thread
From: Jakub Jelinek @ 2010-06-29 15:29 UTC (permalink / raw)
  To: Richard Guenther, Alexandre Oliva; +Cc: gcc-patches

Hi!

On the ginac.ii testcase cc1plus spends huge amount of time in var-tracking.
The problem is that there are many variables with values sp + const_int
(e.g. this pointers for huge amount of methods) and code to handle
reversible ops results in very long loc_chain lists (up to 3740 entries),
where the sp value is equvalenced with (plus (some_other_value) (const_int N))
for many different values (and corresponding offsets).

Fixed by canonicalizing sp (resp. hardfp) to (framep) + offset
even outside of MEM addresses when on the RHS and not doing
reversible ops for framep - which doesn't buy us anything, framep is always
computable using DW_OP_fbreg anywhere in the function.

The speedup for ginac.ii -g -O2 is from over 3 minutes to 16 seconds.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2010-06-29  Jakub Jelinek  <jakub@redhat.com>

	PR debug/44694
	* cselib.h (cselib_preserve_cfa_base_value): Add regno argument.
	* cselib.c (cfa_base_preserved_regno): New static variable.
	(cselib_reset_table): Don't reset cfa_base_preserved_regno instead
	of REGNO (cfa_base_preserved_val->locs->loc).
	(cselib_preserve_cfa_base_value): Add regno argument, set
	cfa_base_preserved_regno to it.
	(cselib_invalidate_regno): Allow removal of registers other than
	cfa_base_preserved_regno from cfa_base_preserved_val.
	(cselib_finish): Set cfa_base_preserved_regno to INVALID_REGNUM.
	* var-tracking.c (adjust_mems): Replace sp or hfp even outside
	of MEM addresses, if not on LHS.
	(reverse_op): Don't add reverse ops for cfa_base_rtx.
	(vt_init_cfa_base): Adjust cselib_preserve_cfa_base_value caller.

--- gcc/cselib.h.jj	2010-03-31 13:12:00.000000000 +0200
+++ gcc/cselib.h	2010-06-29 13:45:37.000000000 +0200
@@ -99,6 +99,6 @@ extern unsigned int cselib_get_next_uid 
 extern void cselib_preserve_value (cselib_val *);
 extern bool cselib_preserved_value_p (cselib_val *);
 extern void cselib_preserve_only_values (void);
-extern void cselib_preserve_cfa_base_value (cselib_val *);
+extern void cselib_preserve_cfa_base_value (cselib_val *, unsigned int);
 
 extern void dump_cselib_table (FILE *);
--- gcc/cselib.c.jj	2010-05-25 11:27:47.000000000 +0200
+++ gcc/cselib.c	2010-06-29 14:05:59.000000000 +0200
@@ -178,6 +178,7 @@ static cselib_val dummy_val;
    that is constant through the whole function and should never be
    eliminated.  */
 static cselib_val *cfa_base_preserved_val;
+static unsigned int cfa_base_preserved_regno;
 
 /* Used to list all values that contain memory reference.
    May or may not contain the useless values - the list is compacted
@@ -338,7 +339,7 @@ cselib_reset_table (unsigned int num)
 
   if (cfa_base_preserved_val)
     {
-      unsigned int regno = REGNO (cfa_base_preserved_val->locs->loc);
+      unsigned int regno = cfa_base_preserved_regno;
       unsigned int new_used_regs = 0;
       for (i = 0; i < n_used_regs; i++)
 	if (used_regs[i] == regno)
@@ -571,12 +572,15 @@ cselib_preserved_value_p (cselib_val *v)
    never invalidated and preserved across cselib_reset_table calls.  */
 
 void
-cselib_preserve_cfa_base_value (cselib_val *v)
+cselib_preserve_cfa_base_value (cselib_val *v, unsigned int regno)
 {
   if (cselib_preserve_constants
       && v->locs
       && REG_P (v->locs->loc))
-    cfa_base_preserved_val = v;
+    {
+      cfa_base_preserved_val = v;
+      cfa_base_preserved_regno = regno;
+    }
 }
 
 /* Clean all non-constant expressions in the hash table, but retain
@@ -1783,7 +1787,9 @@ cselib_invalidate_regno (unsigned int re
 	  if (i < FIRST_PSEUDO_REGISTER && v != NULL)
 	    this_last = end_hard_regno (GET_MODE (v->val_rtx), i) - 1;
 
-	  if (this_last < regno || v == NULL || v == cfa_base_preserved_val)
+	  if (this_last < regno || v == NULL
+	      || (v == cfa_base_preserved_val
+		  && i == cfa_base_preserved_regno))
 	    {
 	      l = &(*l)->next;
 	      continue;
@@ -2266,6 +2272,7 @@ cselib_finish (void)
   cselib_discard_hook = NULL;
   cselib_preserve_constants = false;
   cfa_base_preserved_val = NULL;
+  cfa_base_preserved_regno = INVALID_REGNUM;
   free_alloc_pool (elt_list_pool);
   free_alloc_pool (elt_loc_list_pool);
   free_alloc_pool (cselib_val_pool);
--- gcc/var-tracking.c.jj	2010-06-29 10:33:44.000000000 +0200
+++ gcc/var-tracking.c	2010-06-29 13:46:07.000000000 +0200
@@ -798,8 +798,9 @@ adjust_mems (rtx loc, const_rtx old_rtx,
   switch (GET_CODE (loc))
     {
     case REG:
-      /* Don't do any sp or fp replacements outside of MEM addresses.  */
-      if (amd->mem_mode == VOIDmode)
+      /* Don't do any sp or fp replacements outside of MEM addresses
+         on the LHS.  */
+      if (amd->mem_mode == VOIDmode && amd->store)
 	return loc;
       if (loc == stack_pointer_rtx
 	  && !frame_pointer_needed)
@@ -5193,7 +5194,9 @@ reverse_op (rtx val, const_rtx expr)
       return NULL_RTX;
     }
 
-  if (!REG_P (XEXP (src, 0)) || !SCALAR_INT_MODE_P (GET_MODE (src)))
+  if (!REG_P (XEXP (src, 0))
+      || !SCALAR_INT_MODE_P (GET_MODE (src))
+      || XEXP (src, 0) == cfa_base_rtx)
     return NULL_RTX;
 
   v = cselib_lookup (XEXP (src, 0), GET_MODE (XEXP (src, 0)), 0);
@@ -8163,7 +8166,7 @@ vt_init_cfa_base (void)
   val = cselib_lookup_from_insn (cfa_base_rtx, GET_MODE (cfa_base_rtx), 1,
 				 get_insns ());
   preserve_value (val);
-  cselib_preserve_cfa_base_value (val);
+  cselib_preserve_cfa_base_value (val, REGNO (cfa_base_rtx));
   var_reg_decl_set (&VTI (ENTRY_BLOCK_PTR)->out, cfa_base_rtx,
 		    VAR_INIT_STATUS_INITIALIZED, dv_from_value (val->val_rtx),
 		    0, NULL_RTX, INSERT);

	Jakub

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Do framep replacement even on RHS outside of MEM contexts (PR debug/44694)
  2010-06-29 15:29 [PATCH] Do framep replacement even on RHS outside of MEM contexts (PR debug/44694) Jakub Jelinek
@ 2010-06-29 15:46 ` Richard Guenther
  2010-06-29 16:03   ` Jakub Jelinek
  2010-07-01  8:13 ` Jie Zhang
  1 sibling, 1 reply; 8+ messages in thread
From: Richard Guenther @ 2010-06-29 15:46 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Alexandre Oliva, gcc-patches

On Tue, 29 Jun 2010, Jakub Jelinek wrote:

> Hi!
> 
> On the ginac.ii testcase cc1plus spends huge amount of time in var-tracking.
> The problem is that there are many variables with values sp + const_int
> (e.g. this pointers for huge amount of methods) and code to handle
> reversible ops results in very long loc_chain lists (up to 3740 entries),
> where the sp value is equvalenced with (plus (some_other_value) (const_int N))
> for many different values (and corresponding offsets).
> 
> Fixed by canonicalizing sp (resp. hardfp) to (framep) + offset
> even outside of MEM addresses when on the RHS and not doing
> reversible ops for framep - which doesn't buy us anything, framep is always
> computable using DW_OP_fbreg anywhere in the function.
> 
> The speedup for ginac.ii -g -O2 is from over 3 minutes to 16 seconds.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Ok.  Does this also apply to the branch?

Thanks,
Richard.

> 2010-06-29  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR debug/44694
> 	* cselib.h (cselib_preserve_cfa_base_value): Add regno argument.
> 	* cselib.c (cfa_base_preserved_regno): New static variable.
> 	(cselib_reset_table): Don't reset cfa_base_preserved_regno instead
> 	of REGNO (cfa_base_preserved_val->locs->loc).
> 	(cselib_preserve_cfa_base_value): Add regno argument, set
> 	cfa_base_preserved_regno to it.
> 	(cselib_invalidate_regno): Allow removal of registers other than
> 	cfa_base_preserved_regno from cfa_base_preserved_val.
> 	(cselib_finish): Set cfa_base_preserved_regno to INVALID_REGNUM.
> 	* var-tracking.c (adjust_mems): Replace sp or hfp even outside
> 	of MEM addresses, if not on LHS.
> 	(reverse_op): Don't add reverse ops for cfa_base_rtx.
> 	(vt_init_cfa_base): Adjust cselib_preserve_cfa_base_value caller.
> 
> --- gcc/cselib.h.jj	2010-03-31 13:12:00.000000000 +0200
> +++ gcc/cselib.h	2010-06-29 13:45:37.000000000 +0200
> @@ -99,6 +99,6 @@ extern unsigned int cselib_get_next_uid 
>  extern void cselib_preserve_value (cselib_val *);
>  extern bool cselib_preserved_value_p (cselib_val *);
>  extern void cselib_preserve_only_values (void);
> -extern void cselib_preserve_cfa_base_value (cselib_val *);
> +extern void cselib_preserve_cfa_base_value (cselib_val *, unsigned int);
>  
>  extern void dump_cselib_table (FILE *);
> --- gcc/cselib.c.jj	2010-05-25 11:27:47.000000000 +0200
> +++ gcc/cselib.c	2010-06-29 14:05:59.000000000 +0200
> @@ -178,6 +178,7 @@ static cselib_val dummy_val;
>     that is constant through the whole function and should never be
>     eliminated.  */
>  static cselib_val *cfa_base_preserved_val;
> +static unsigned int cfa_base_preserved_regno;
>  
>  /* Used to list all values that contain memory reference.
>     May or may not contain the useless values - the list is compacted
> @@ -338,7 +339,7 @@ cselib_reset_table (unsigned int num)
>  
>    if (cfa_base_preserved_val)
>      {
> -      unsigned int regno = REGNO (cfa_base_preserved_val->locs->loc);
> +      unsigned int regno = cfa_base_preserved_regno;
>        unsigned int new_used_regs = 0;
>        for (i = 0; i < n_used_regs; i++)
>  	if (used_regs[i] == regno)
> @@ -571,12 +572,15 @@ cselib_preserved_value_p (cselib_val *v)
>     never invalidated and preserved across cselib_reset_table calls.  */
>  
>  void
> -cselib_preserve_cfa_base_value (cselib_val *v)
> +cselib_preserve_cfa_base_value (cselib_val *v, unsigned int regno)
>  {
>    if (cselib_preserve_constants
>        && v->locs
>        && REG_P (v->locs->loc))
> -    cfa_base_preserved_val = v;
> +    {
> +      cfa_base_preserved_val = v;
> +      cfa_base_preserved_regno = regno;
> +    }
>  }
>  
>  /* Clean all non-constant expressions in the hash table, but retain
> @@ -1783,7 +1787,9 @@ cselib_invalidate_regno (unsigned int re
>  	  if (i < FIRST_PSEUDO_REGISTER && v != NULL)
>  	    this_last = end_hard_regno (GET_MODE (v->val_rtx), i) - 1;
>  
> -	  if (this_last < regno || v == NULL || v == cfa_base_preserved_val)
> +	  if (this_last < regno || v == NULL
> +	      || (v == cfa_base_preserved_val
> +		  && i == cfa_base_preserved_regno))
>  	    {
>  	      l = &(*l)->next;
>  	      continue;
> @@ -2266,6 +2272,7 @@ cselib_finish (void)
>    cselib_discard_hook = NULL;
>    cselib_preserve_constants = false;
>    cfa_base_preserved_val = NULL;
> +  cfa_base_preserved_regno = INVALID_REGNUM;
>    free_alloc_pool (elt_list_pool);
>    free_alloc_pool (elt_loc_list_pool);
>    free_alloc_pool (cselib_val_pool);
> --- gcc/var-tracking.c.jj	2010-06-29 10:33:44.000000000 +0200
> +++ gcc/var-tracking.c	2010-06-29 13:46:07.000000000 +0200
> @@ -798,8 +798,9 @@ adjust_mems (rtx loc, const_rtx old_rtx,
>    switch (GET_CODE (loc))
>      {
>      case REG:
> -      /* Don't do any sp or fp replacements outside of MEM addresses.  */
> -      if (amd->mem_mode == VOIDmode)
> +      /* Don't do any sp or fp replacements outside of MEM addresses
> +         on the LHS.  */
> +      if (amd->mem_mode == VOIDmode && amd->store)
>  	return loc;
>        if (loc == stack_pointer_rtx
>  	  && !frame_pointer_needed)
> @@ -5193,7 +5194,9 @@ reverse_op (rtx val, const_rtx expr)
>        return NULL_RTX;
>      }
>  
> -  if (!REG_P (XEXP (src, 0)) || !SCALAR_INT_MODE_P (GET_MODE (src)))
> +  if (!REG_P (XEXP (src, 0))
> +      || !SCALAR_INT_MODE_P (GET_MODE (src))
> +      || XEXP (src, 0) == cfa_base_rtx)
>      return NULL_RTX;
>  
>    v = cselib_lookup (XEXP (src, 0), GET_MODE (XEXP (src, 0)), 0);
> @@ -8163,7 +8166,7 @@ vt_init_cfa_base (void)
>    val = cselib_lookup_from_insn (cfa_base_rtx, GET_MODE (cfa_base_rtx), 1,
>  				 get_insns ());
>    preserve_value (val);
> -  cselib_preserve_cfa_base_value (val);
> +  cselib_preserve_cfa_base_value (val, REGNO (cfa_base_rtx));
>    var_reg_decl_set (&VTI (ENTRY_BLOCK_PTR)->out, cfa_base_rtx,
>  		    VAR_INIT_STATUS_INITIALIZED, dv_from_value (val->val_rtx),
>  		    0, NULL_RTX, INSERT);
> 
> 	Jakub
> 
> 

-- 
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Do framep replacement even on RHS outside of MEM contexts (PR debug/44694)
  2010-06-29 15:46 ` Richard Guenther
@ 2010-06-29 16:03   ` Jakub Jelinek
  0 siblings, 0 replies; 8+ messages in thread
From: Jakub Jelinek @ 2010-06-29 16:03 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Alexandre Oliva, gcc-patches

On Tue, Jun 29, 2010 at 04:33:26PM +0200, Richard Guenther wrote:
> On Tue, 29 Jun 2010, Jakub Jelinek wrote:
> > On the ginac.ii testcase cc1plus spends huge amount of time in var-tracking.
> > The problem is that there are many variables with values sp + const_int
> > (e.g. this pointers for huge amount of methods) and code to handle
> > reversible ops results in very long loc_chain lists (up to 3740 entries),
> > where the sp value is equvalenced with (plus (some_other_value) (const_int N))
> > for many different values (and corresponding offsets).
> > 
> > Fixed by canonicalizing sp (resp. hardfp) to (framep) + offset
> > even outside of MEM addresses when on the RHS and not doing
> > reversible ops for framep - which doesn't buy us anything, framep is always
> > computable using DW_OP_fbreg anywhere in the function.
> > 
> > The speedup for ginac.ii -g -O2 is from over 3 minutes to 16 seconds.
> > 
> > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> Ok.  Does this also apply to the branch?

I guess so, I'd just wait for a few days before backporting it.

	Jakub

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Do framep replacement even on RHS outside of MEM contexts (PR debug/44694)
  2010-06-29 15:29 [PATCH] Do framep replacement even on RHS outside of MEM contexts (PR debug/44694) Jakub Jelinek
  2010-06-29 15:46 ` Richard Guenther
@ 2010-07-01  8:13 ` Jie Zhang
  2010-07-01  8:21   ` Jakub Jelinek
  1 sibling, 1 reply; 8+ messages in thread
From: Jie Zhang @ 2010-07-01  8:13 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Richard Guenther, Alexandre Oliva, gcc-patches

On 06/29/2010 10:31 PM, Jakub Jelinek wrote:
> Hi!
>
> On the ginac.ii testcase cc1plus spends huge amount of time in var-tracking.
> The problem is that there are many variables with values sp + const_int
> (e.g. this pointers for huge amount of methods) and code to handle
> reversible ops results in very long loc_chain lists (up to 3740 entries),
> where the sp value is equvalenced with (plus (some_other_value) (const_int N))
> for many different values (and corresponding offsets).
>
> Fixed by canonicalizing sp (resp. hardfp) to (framep) + offset
> even outside of MEM addresses when on the RHS and not doing
> reversible ops for framep - which doesn't buy us anything, framep is always
> computable using DW_OP_fbreg anywhere in the function.
>
> The speedup for ginac.ii -g -O2 is from over 3 minutes to 16 seconds.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2010-06-29  Jakub Jelinek<jakub@redhat.com>
>
> 	PR debug/44694
> 	* cselib.h (cselib_preserve_cfa_base_value): Add regno argument.
> 	* cselib.c (cfa_base_preserved_regno): New static variable.
> 	(cselib_reset_table): Don't reset cfa_base_preserved_regno instead
> 	of REGNO (cfa_base_preserved_val->locs->loc).
> 	(cselib_preserve_cfa_base_value): Add regno argument, set
> 	cfa_base_preserved_regno to it.
> 	(cselib_invalidate_regno): Allow removal of registers other than
> 	cfa_base_preserved_regno from cfa_base_preserved_val.
> 	(cselib_finish): Set cfa_base_preserved_regno to INVALID_REGNUM.
> 	* var-tracking.c (adjust_mems): Replace sp or hfp even outside
> 	of MEM addresses, if not on LHS.
> 	(reverse_op): Don't add reverse ops for cfa_base_rtx.
> 	(vt_init_cfa_base): Adjust cselib_preserve_cfa_base_value caller.
>

This patch caused ICE for arm-none-eabi target:

internal compiler error: in arm_dbx_register_number, at 
config/arm/arm.c:21155

when compiling thumb multilib libstdc++.

> --- gcc/var-tracking.c.jj	2010-06-29 10:33:44.000000000 +0200
> +++ gcc/var-tracking.c	2010-06-29 13:46:07.000000000 +0200
> @@ -798,8 +798,9 @@ adjust_mems (rtx loc, const_rtx old_rtx,
>     switch (GET_CODE (loc))
>       {
>       case REG:
> -      /* Don't do any sp or fp replacements outside of MEM addresses.  */
> -      if (amd->mem_mode == VOIDmode)
> +      /* Don't do any sp or fp replacements outside of MEM addresses
> +         on the LHS.  */
> +      if (amd->mem_mode == VOIDmode&&  amd->store)
>   	return loc;
>         if (loc == stack_pointer_rtx
>   	&&  !frame_pointer_needed)

If I revert this change, the ICE is gone.

The ICE occurs when arm_dbx_register_number receives ARG_POINTER_REGNUM 
but it doesn't handle it since it isn't a hardware register.

x86 has no such problem because DBX_REGISTER_NUMBER returns -1 for non 
hardware register.


Regards,
-- 
Jie Zhang
CodeSourcery

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Do framep replacement even on RHS outside of MEM contexts (PR debug/44694)
  2010-07-01  8:13 ` Jie Zhang
@ 2010-07-01  8:21   ` Jakub Jelinek
  2010-07-01  8:34     ` Jie Zhang
  2010-07-01 11:06     ` [PATCH] Do framep replacement even on RHS outside of MEM contexts (PR debug/44694 followup) Jakub Jelinek
  0 siblings, 2 replies; 8+ messages in thread
From: Jakub Jelinek @ 2010-07-01  8:21 UTC (permalink / raw)
  To: Jie Zhang; +Cc: Richard Guenther, Alexandre Oliva, gcc-patches

On Thu, Jul 01, 2010 at 04:13:03PM +0800, Jie Zhang wrote:
> This patch caused ICE for arm-none-eabi target:
> 
> internal compiler error: in arm_dbx_register_number, at
> config/arm/arm.c:21155
> 
> when compiling thumb multilib libstdc++.

Richard Earnshaw has already reported this in the PR, and here is my fix for
that.  I don't have any arm boxes, so will just test it on x86_64-linux and
i686-linux (the PR44694 patch has been tested also on ppc/ppc64/s390/s390x
btw), could you please test it on arm?  Thanks.

2010-07-01  Jakub Jelinek  <jakub@redhat.com>

	PR debug/44694
	* dwarf2out.c (reg_loc_descriptor): For eliminated arg_pointer_rtx
	or frame_pointer_rtx use DW_OP_fbreg offset DW_OP_stack_value.

--- gcc/dwarf2out.c.jj	2010-07-01 08:45:55.000000000 +0200
+++ gcc/dwarf2out.c	2010-07-01 09:19:47.000000000 +0200
@@ -12999,6 +12999,26 @@ reg_loc_descriptor (rtx rtl, enum var_in
   if (REGNO (rtl) >= FIRST_PSEUDO_REGISTER)
     return 0;
 
+  /* We only use "frame base" when we're sure we're talking about the
+     post-prologue local stack frame.  We do this by *not* running
+     register elimination until this point, and recognizing the special
+     argument pointer and soft frame pointer rtx's.
+     Use DW_OP_fbreg offset DW_OP_stack_value in this case.  */
+  if ((rtl == arg_pointer_rtx || rtl == frame_pointer_rtx)
+      && eliminate_regs (rtl, VOIDmode, NULL_RTX) != rtl)
+    {
+      dw_loc_descr_ref result = NULL;
+
+      if (dwarf_version >= 4 || !dwarf_strict)
+	{
+	  result = mem_loc_descriptor (rtl, VOIDmode, initialized);
+	  if (result)
+	    add_loc_descr (&result,
+			   new_loc_descr (DW_OP_stack_value, 0, 0));
+	}
+      return result;
+    }
+
   regs = targetm.dwarf_register_span (rtl);
 
   if (hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)] > 1 || regs)


	Jakub

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Do framep replacement even on RHS outside of MEM contexts (PR debug/44694)
  2010-07-01  8:21   ` Jakub Jelinek
@ 2010-07-01  8:34     ` Jie Zhang
  2010-07-01 11:06     ` [PATCH] Do framep replacement even on RHS outside of MEM contexts (PR debug/44694 followup) Jakub Jelinek
  1 sibling, 0 replies; 8+ messages in thread
From: Jie Zhang @ 2010-07-01  8:34 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Richard Guenther, Alexandre Oliva, gcc-patches

On 07/01/2010 04:22 PM, Jakub Jelinek wrote:
> On Thu, Jul 01, 2010 at 04:13:03PM +0800, Jie Zhang wrote:
>> This patch caused ICE for arm-none-eabi target:
>>
>> internal compiler error: in arm_dbx_register_number, at
>> config/arm/arm.c:21155
>>
>> when compiling thumb multilib libstdc++.
>
> Richard Earnshaw has already reported this in the PR, and here is my fix for
> that.  I don't have any arm boxes, so will just test it on x86_64-linux and
> i686-linux (the PR44694 patch has been tested also on ppc/ppc64/s390/s390x
> btw), could you please test it on arm?  Thanks.
>
> 2010-07-01  Jakub Jelinek<jakub@redhat.com>
>
> 	PR debug/44694
> 	* dwarf2out.c (reg_loc_descriptor): For eliminated arg_pointer_rtx
> 	or frame_pointer_rtx use DW_OP_fbreg offset DW_OP_stack_value.
>
Yes. This fixes the ICE I saw. Thanks!


-- 
Jie Zhang
CodeSourcery

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] Do framep replacement even on RHS outside of MEM contexts (PR debug/44694 followup)
  2010-07-01  8:21   ` Jakub Jelinek
  2010-07-01  8:34     ` Jie Zhang
@ 2010-07-01 11:06     ` Jakub Jelinek
  2010-07-01 11:07       ` Richard Guenther
  1 sibling, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2010-07-01 11:06 UTC (permalink / raw)
  To: Jason Merrill, Richard Guenther; +Cc: Jie Zhang, Alexandre Oliva, gcc-patches

On Thu, Jul 01, 2010 at 10:22:05AM +0200, Jakub Jelinek wrote:
> On Thu, Jul 01, 2010 at 04:13:03PM +0800, Jie Zhang wrote:
> > This patch caused ICE for arm-none-eabi target:
> > 
> > internal compiler error: in arm_dbx_register_number, at
> > config/arm/arm.c:21155
> > 
> > when compiling thumb multilib libstdc++.
> 
> Richard Earnshaw has already reported this in the PR, and here is my fix for
> that.  I don't have any arm boxes, so will just test it on x86_64-linux and
> i686-linux (the PR44694 patch has been tested also on ppc/ppc64/s390/s390x
> btw), could you please test it on arm?  Thanks.
> 
> 2010-07-01  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR debug/44694
> 	* dwarf2out.c (reg_loc_descriptor): For eliminated arg_pointer_rtx
> 	or frame_pointer_rtx use DW_OP_fbreg offset DW_OP_stack_value.

Now bootstrapped/regtested on x86_64-linux and i686-linux.  Ok for trunk/4.5?

> --- gcc/dwarf2out.c.jj	2010-07-01 08:45:55.000000000 +0200
> +++ gcc/dwarf2out.c	2010-07-01 09:19:47.000000000 +0200
> @@ -12999,6 +12999,26 @@ reg_loc_descriptor (rtx rtl, enum var_in
>    if (REGNO (rtl) >= FIRST_PSEUDO_REGISTER)
>      return 0;
>  
> +  /* We only use "frame base" when we're sure we're talking about the
> +     post-prologue local stack frame.  We do this by *not* running
> +     register elimination until this point, and recognizing the special
> +     argument pointer and soft frame pointer rtx's.
> +     Use DW_OP_fbreg offset DW_OP_stack_value in this case.  */
> +  if ((rtl == arg_pointer_rtx || rtl == frame_pointer_rtx)
> +      && eliminate_regs (rtl, VOIDmode, NULL_RTX) != rtl)
> +    {
> +      dw_loc_descr_ref result = NULL;
> +
> +      if (dwarf_version >= 4 || !dwarf_strict)
> +	{
> +	  result = mem_loc_descriptor (rtl, VOIDmode, initialized);
> +	  if (result)
> +	    add_loc_descr (&result,
> +			   new_loc_descr (DW_OP_stack_value, 0, 0));
> +	}
> +      return result;
> +    }
> +
>    regs = targetm.dwarf_register_span (rtl);
>  
>    if (hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)] > 1 || regs)
> 

	Jakub

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Do framep replacement even on RHS outside of MEM contexts (PR debug/44694 followup)
  2010-07-01 11:06     ` [PATCH] Do framep replacement even on RHS outside of MEM contexts (PR debug/44694 followup) Jakub Jelinek
@ 2010-07-01 11:07       ` Richard Guenther
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Guenther @ 2010-07-01 11:07 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Jason Merrill, Jie Zhang, Alexandre Oliva, gcc-patches

On Thu, 1 Jul 2010, Jakub Jelinek wrote:

> On Thu, Jul 01, 2010 at 10:22:05AM +0200, Jakub Jelinek wrote:
> > On Thu, Jul 01, 2010 at 04:13:03PM +0800, Jie Zhang wrote:
> > > This patch caused ICE for arm-none-eabi target:
> > > 
> > > internal compiler error: in arm_dbx_register_number, at
> > > config/arm/arm.c:21155
> > > 
> > > when compiling thumb multilib libstdc++.
> > 
> > Richard Earnshaw has already reported this in the PR, and here is my fix for
> > that.  I don't have any arm boxes, so will just test it on x86_64-linux and
> > i686-linux (the PR44694 patch has been tested also on ppc/ppc64/s390/s390x
> > btw), could you please test it on arm?  Thanks.
> > 
> > 2010-07-01  Jakub Jelinek  <jakub@redhat.com>
> > 
> > 	PR debug/44694
> > 	* dwarf2out.c (reg_loc_descriptor): For eliminated arg_pointer_rtx
> > 	or frame_pointer_rtx use DW_OP_fbreg offset DW_OP_stack_value.
> 
> Now bootstrapped/regtested on x86_64-linux and i686-linux.  Ok for trunk/4.5?

Ok.

Thanks,
Richard.

> > --- gcc/dwarf2out.c.jj	2010-07-01 08:45:55.000000000 +0200
> > +++ gcc/dwarf2out.c	2010-07-01 09:19:47.000000000 +0200
> > @@ -12999,6 +12999,26 @@ reg_loc_descriptor (rtx rtl, enum var_in
> >    if (REGNO (rtl) >= FIRST_PSEUDO_REGISTER)
> >      return 0;
> >  
> > +  /* We only use "frame base" when we're sure we're talking about the
> > +     post-prologue local stack frame.  We do this by *not* running
> > +     register elimination until this point, and recognizing the special
> > +     argument pointer and soft frame pointer rtx's.
> > +     Use DW_OP_fbreg offset DW_OP_stack_value in this case.  */
> > +  if ((rtl == arg_pointer_rtx || rtl == frame_pointer_rtx)
> > +      && eliminate_regs (rtl, VOIDmode, NULL_RTX) != rtl)
> > +    {
> > +      dw_loc_descr_ref result = NULL;
> > +
> > +      if (dwarf_version >= 4 || !dwarf_strict)
> > +	{
> > +	  result = mem_loc_descriptor (rtl, VOIDmode, initialized);
> > +	  if (result)
> > +	    add_loc_descr (&result,
> > +			   new_loc_descr (DW_OP_stack_value, 0, 0));
> > +	}
> > +      return result;
> > +    }
> > +
> >    regs = targetm.dwarf_register_span (rtl);
> >  
> >    if (hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)] > 1 || regs)
> > 
> 
> 	Jakub
> 
> 

-- 
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-07-01 11:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-29 15:29 [PATCH] Do framep replacement even on RHS outside of MEM contexts (PR debug/44694) Jakub Jelinek
2010-06-29 15:46 ` Richard Guenther
2010-06-29 16:03   ` Jakub Jelinek
2010-07-01  8:13 ` Jie Zhang
2010-07-01  8:21   ` Jakub Jelinek
2010-07-01  8:34     ` Jie Zhang
2010-07-01 11:06     ` [PATCH] Do framep replacement even on RHS outside of MEM contexts (PR debug/44694 followup) Jakub Jelinek
2010-07-01 11:07       ` Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).