+2019-05-31 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.
+
2019-05-31 Iain Sandoe <iain@sandoe.co.uk>
* config/i386/darwin.h (ASM_OUTPUT_MAX_SKIP_ALIGN): New.
+2019-05-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/90671
+ * gcc.dg/torture/pr90671.c: New test.
+
2019-05-31 Iain Sandoe <iain@sandoe.co.uk>
* g++.dg/cpp0x/pr84497.C: Require alias support.
--- /dev/null
+/* 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;
+}
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. */