aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-threadupdate.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-05-31 09:53:48 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-05-31 09:53:48 +0200
commit6992d6fbf2ffdb4a5c78604fbf33ae95956fffdd (patch)
tree60a8f12d775717b56975226f009fb27e15718573 /gcc/tree-ssa-threadupdate.c
parent0eee8eaa834181720cfb4e360a1c69d77c74b552 (diff)
downloadgcc-6992d6fbf2ffdb4a5c78604fbf33ae95956fffdd.zip
gcc-6992d6fbf2ffdb4a5c78604fbf33ae95956fffdd.tar.gz
gcc-6992d6fbf2ffdb4a5c78604fbf33ae95956fffdd.tar.bz2
re PR tree-optimization/90671 (ICE on valid code at -Os and above with -g enabled in gsi_split_seq_after, at gimple-iterator.c:345)
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. From-SVN: r271802
Diffstat (limited to 'gcc/tree-ssa-threadupdate.c')
-rw-r--r--gcc/tree-ssa-threadupdate.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index d631543..a56ccfb 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -1142,12 +1142,25 @@ ssa_create_duplicates (struct redirection_data **slot,
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. */