public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@adacore.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix dead_debug_insert_before ICE (PR debug/49522, take 3)
Date: Thu, 07 Jul 2011 15:53:00 -0000	[thread overview]
Message-ID: <201107071750.24795.ebotcazou@adacore.com> (raw)
In-Reply-To: <20110707101935.GM2687@tyan-ft48-01.lab.bos.redhat.com>

> So, here is a new patch which doesn't need two loops, just might go a
> little bit backwards to unchain dead_debug_use for the reset insn.
>
> It still needs the change of the gcc_assert (reg) into if (reg == NULL)
> return;, because the dead->used bitmap is with this sometimes a false
> positive (saying that a regno is referenced even when it isn't).
> But here it is IMHO better to occassionaly live with the false positives,
> which just means we'll sometimes once walk the chain in dead_debug_reset
> or dead_debug_insert_before before resetting it, than to recompute the
> bitmap (we'd need a second loop for that, bitmap_clear (debug->used) and
> populate it again).

Fine with me for both points, but move some bits of these explanations to the 
code itself because this isn't obvious.  For example see below.

> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2011-07-07  Jakub Jelinek  <jakub@redhat.com>
>
> 	PR debug/49522
> 	* df-problems.c (dead_debug_reset): Remove dead_debug_uses
> 	referencing debug insns that have been reset.
> 	(dead_debug_insert_before): Don't assert reg is non-NULL,
> 	instead return immediately if it is NULL.
>
> 	* gcc.dg/debug/pr49522.c: New test.

OK, thanks.

> --- gcc/df-problems.c.jj	2011-07-07 02:32:45.928547053 +0200
> +++ gcc/df-problems.c	2011-07-07 09:57:34.846464573 +0200
> @@ -3096,6 +3096,7 @@ static void
>  dead_debug_reset (struct dead_debug *debug, unsigned int dregno)
>  {
>    struct dead_debug_use **tailp = &debug->head;
> +  struct dead_debug_use **insnp = &debug->head;
>    struct dead_debug_use *cur;
>    rtx insn;
>
> @@ -3113,9 +3114,21 @@ dead_debug_reset (struct dead_debug *deb
>  	    debug->to_rescan = BITMAP_ALLOC (NULL);
>  	  bitmap_set_bit (debug->to_rescan, INSN_UID (insn));
>  	  XDELETE (cur);
> +	  if (tailp != insnp && DF_REF_INSN ((*insnp)->use) == insn)
> +	    tailp = insnp;

/* If the current use isn't the first one attached to INSN, go back to this
   first use.  We assume that the uses attached to an insn are adjacent.  */

> +	  while ((cur = *tailp) && DF_REF_INSN (cur->use) == insn)
> +	    {
> +	      *tailp = cur->next;
> +	      XDELETE (cur);
> +	    }
> +	  insnp = tailp;

/* Then remove all the other uses attached to INSN.  */

>  	}
>        else
> -	tailp = &(*tailp)->next;
> +	{
> +	  if (DF_REF_INSN ((*insnp)->use) != DF_REF_INSN (cur->use))
> +	    insnp = tailp;
> +	  tailp = &(*tailp)->next;
> +	}
>      }
>  }
>
> @@ -3174,7 +3187,8 @@ dead_debug_insert_before (struct dead_de
>  	tailp = &(*tailp)->next;
>      }
>
> -  gcc_assert (reg);
> +  if (reg == NULL)
> +    return;

/* We may have dangling bits in debug->used for registers that were part of
   a multi-register use, one component of which has been reset.  */


-- 
Eric Botcazou

  reply	other threads:[~2011-07-07 15:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-04 17:29 [PATCH] Fix dead_debug_insert_before ICE (PR debug/49522) Jakub Jelinek
2011-07-05  8:51 ` Eric Botcazou
2011-07-05 20:12   ` Jakub Jelinek
2011-07-06 19:48     ` [PATCH] Fix dead_debug_insert_before ICE (PR debug/49522, take 2) Jakub Jelinek
2011-07-06 20:55       ` Eric Botcazou
2011-07-07 10:27         ` [PATCH] Fix dead_debug_insert_before ICE (PR debug/49522, take 3) Jakub Jelinek
2011-07-07 15:53           ` Eric Botcazou [this message]
2011-07-06 20:36     ` [PATCH] Fix dead_debug_insert_before ICE (PR debug/49522) Eric Botcazou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201107071750.24795.ebotcazou@adacore.com \
    --to=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).