Commit 3b778d9d by Alexandre Oliva Committed by Jakub Jelinek

re PR bootstrap/83396 (Bootstrap failures with Statement Frontiers)

	PR bootstrap/83396
	PR debug/83391
	* tree-cfgcleanup.c (remove_forwarder_block): Keep after
	labels debug stmts that can only appear after labels.

	* gcc.dg/torture/pr83396.c: New test.
	* g++.dg/torture/pr83391.C: New test.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r255609
parent 3ca652c1
2017-12-13 Alexandre Oliva <aoliva@redhat.com>
Jakub Jelinek <jakub@redhat.com>
PR bootstrap/83396
PR debug/83391
* tree-cfgcleanup.c (remove_forwarder_block): Keep after
labels debug stmts that can only appear after labels.
2017-12-13 Alexander Monakov <amonakov@ispras.ru>
PR rtl-optimization/82398
2017-12-13 Alexandre Oliva <aoliva@redhat.com>
Jakub Jelinek <jakub@redhat.com>
PR bootstrap/83396
PR debug/83391
* gcc.dg/torture/pr83396.c: New test.
* g++.dg/torture/pr83391.C: New test.
2017-12-13 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/83393
......
// PR debug/83391
// { dg-do compile }
// { dg-options "-g" }
// { dg-additional-options "-mbranch-cost=1" { target { i?86-*-* x86_64-*-* mips*-*-* s390*-*-* avr*-*-* } } }
unsigned char a;
enum E { F, G, H } b;
int c, d;
void
foo ()
{
int e;
bool f;
E g = b;
while (1)
{
unsigned char h = a ? d : 0;
switch (g)
{
case 0:
f = h <= 'Z' || h >= 'a' && h <= 'z';
break;
case 1:
{
unsigned char i = h;
e = 0;
}
if (e || h)
g = H;
/* FALLTHRU */
default:
c = 0;
}
}
}
/* PR bootstrap/83396 */
/* { dg-do compile } */
/* { dg-options "-g" } */
int fn1 (void);
void fn2 (void *, const char *);
void fn3 (void);
void
fn4 (long long x)
{
fn3 ();
}
void
fn5 (long long x)
{
if (x)
fn3();
}
void
fn6 (long long x)
{
switch (fn1 ())
{
case 0:
fn5 (x);
case 2:
fn2 (0, "");
break;
case 1:
case 3:
fn4(x);
case 5:
fn2 (0, "");
}
}
......@@ -536,9 +536,14 @@ remove_forwarder_block (basic_block bb)
defined labels and labels with an EH landing pad number to the
new block, so that the redirection of the abnormal edges works,
jump targets end up in a sane place and debug information for
labels is retained. */
labels is retained.
While at that, move any debug stmts that appear before or in between
labels, but not those that can only appear after labels. */
gsi_to = gsi_start_bb (dest);
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
gsi = gsi_start_bb (bb);
gimple_stmt_iterator gsie = gsi_after_labels (bb);
while (gsi_stmt (gsi) != gsi_stmt (gsie))
{
tree decl;
label = gsi_stmt (gsi);
......@@ -557,6 +562,21 @@ remove_forwarder_block (basic_block bb)
gsi_next (&gsi);
}
/* Move debug statements if the destination has a single predecessor. */
if (can_move_debug_stmts && !gsi_end_p (gsi))
{
gcc_assert (gsi_stmt (gsi) == gsi_stmt (gsie));
gimple_stmt_iterator gsie_to = gsi_after_labels (dest);
do
{
gimple *debug = gsi_stmt (gsi);
gcc_assert (is_gimple_debug (debug));
gsi_remove (&gsi, false);
gsi_insert_before (&gsie_to, debug, GSI_SAME_STMT);
}
while (!gsi_end_p (gsi));
}
bitmap_set_bit (cfgcleanup_altered_bbs, dest->index);
/* Update the dominators. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment