From: Richard Biener <rguenther@suse.de>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Jeff Law <law@redhat.com>, Alexandre Oliva <aoliva@redhat.com>,
gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix ICE in ssa_create_duplicates (PR tree-optimization/90671)
Date: Fri, 31 May 2019 08:38:00 -0000 [thread overview]
Message-ID: <alpine.LSU.2.20.1905310944160.10704@zhemvz.fhfr.qr> (raw)
In-Reply-To: <20190530212655.GD19695@tucnak>
[-- Attachment #1: Type: text/plain, Size: 3193 bytes --]
On Thu, 30 May 2019, Jakub Jelinek wrote:
> Hi!
>
> The following testcase ICEs on the trunk, because both gsi_split_seq_after
> and gsi_insert_seq_after have assertions that the split is not after
> gsi_end_p iterator or insertion is not after such an iterator.
>
> My understanding of Alex' change is that it wants to hide any added
> debug stmts temporarily from create_block_for_threading duplication, so that
> it remains just in one of the blocks. Now, template_last_to_copy is
> initialized using last_bb (template_block), if that block is initially
> completely empty, template_last_to_copy will be gsi_end_p, gsi_stmt on it
> NULL, so I think in that case we can't split any sequence anywhere, we
> simply want to hide the whole sequence from the block duplication and put it
> in afterwards.
>
> The following patch does that. Bootstrapped/regtested on x86_64-linux and
> i686-linux, ok for trunk?
OK.
Richard.
> 2019-05-30 Jakub Jelinek <jakub@redhat.com>
>
> PR tree-optimization/90671
> * tree-ssa-threadupdate.c (ssa_create_duplicates): If
> template_block used to be empty on the first call, don't use
> gsi_split_seq_after and gsi_insert_seq_after, but remember whole
> seq with bb_seq and set it with set_bb_seq.
>
> * gcc.dg/torture/pr90671.c: New test.
>
> --- gcc/tree-ssa-threadupdate.c.jj 2019-05-23 12:57:15.522512319 +0200
> +++ gcc/tree-ssa-threadupdate.c 2019-05-30 10:15:44.718468219 +0200
> @@ -1142,12 +1142,25 @@ ssa_create_duplicates (struct redirectio
> gimple_seq seq = NULL;
> if (gsi_stmt (local_info->template_last_to_copy)
> != gsi_stmt (gsi_last_bb (local_info->template_block)))
> - seq = gsi_split_seq_after (local_info->template_last_to_copy);
> + {
> + if (gsi_end_p (local_info->template_last_to_copy))
> + {
> + seq = bb_seq (local_info->template_block);
> + set_bb_seq (local_info->template_block, NULL);
> + }
> + else
> + seq = gsi_split_seq_after (local_info->template_last_to_copy);
> + }
> create_block_for_threading (local_info->template_block, rd, 0,
> &local_info->duplicate_blocks);
> if (seq)
> - gsi_insert_seq_after (&local_info->template_last_to_copy,
> - seq, GSI_SAME_STMT);
> + {
> + if (gsi_end_p (local_info->template_last_to_copy))
> + set_bb_seq (local_info->template_block, seq);
> + else
> + gsi_insert_seq_after (&local_info->template_last_to_copy,
> + seq, GSI_SAME_STMT);
> + }
>
> /* Go ahead and wire up outgoing edges and update PHIs for the duplicate
> block. */
> --- gcc/testsuite/gcc.dg/torture/pr90671.c.jj 2019-05-30 10:20:13.686068207 +0200
> +++ gcc/testsuite/gcc.dg/torture/pr90671.c 2019-05-30 10:19:50.815442342 +0200
> @@ -0,0 +1,16 @@
> +/* PR tree-optimization/90671 */
> +/* { dg-do compile } */
> +/* { dg-additional-options "-w -g" } */
> +
> +int a;
> +
> +int
> +main ()
> +{
> + int b, c;
> + for (c = 0; c < 2; c++)
> + while (a)
> + if (b)
> + break;
> + return 0;
> +}
>
> Jakub
>
--
Richard Biener <rguenther@suse.de>
SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany;
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah; HRB 21284 (AG NÌrnberg)
prev parent reply other threads:[~2019-05-31 7:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-30 21:42 Jakub Jelinek
2019-05-30 21:54 ` Jakub Jelinek
2019-05-31 8:38 ` Richard Biener [this message]
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=alpine.LSU.2.20.1905310944160.10704@zhemvz.fhfr.qr \
--to=rguenther@suse.de \
--cc=aoliva@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=law@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).