Commit 7752e522 by Jakub Jelinek Committed by Jakub Jelinek

re PR bootstrap/41345 (bootstrap comparison failure with --disable-checking)

	PR bootstrap/41345
	* cfgcleanup.c (trivially_empty_bb_p): New function.
	(try_optimize_bb): Use it instead of checking BB_HEAD == BB_END.

	* gcc.dg/pr41345.c: New test.

From-SVN: r153569
parent bde2d108
2009-10-26 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/41345
* cfgcleanup.c (trivially_empty_bb_p): New function.
(try_optimize_bb): Use it instead of checking BB_HEAD == BB_END.
PR debug/41828
* dwarf2out.c (add_pubname, add_pubtype, generic_parameter_die,
add_name_and_src_coords_attributes, gen_namespace_die,
......@@ -958,7 +958,7 @@ old_insns_match_p (int mode ATTRIBUTE_UNUSED, rtx i1, rtx i2)
if (NOTE_INSN_BASIC_BLOCK_P (i1) && NOTE_INSN_BASIC_BLOCK_P (i2))
return true;
p1 = PATTERN (i1);
p1 = PATTERN (i1);
p2 = PATTERN (i2);
if (GET_CODE (p1) != GET_CODE (p2))
......@@ -1814,6 +1814,24 @@ try_crossjump_bb (int mode, basic_block bb)
return changed;
}
/* Return true if BB contains just bb note, or bb note followed
by only DEBUG_INSNs. */
static bool
trivially_empty_bb_p (basic_block bb)
{
rtx insn = BB_END (bb);
while (1)
{
if (insn == BB_HEAD (bb))
return true;
if (!DEBUG_INSN_P (insn))
return false;
insn = PREV_INSN (insn);
}
}
/* Do simple CFG optimizations - basic block merging, simplifying of jump
instructions etc. Return nonzero if changes were made. */
......@@ -1865,14 +1883,10 @@ try_optimize_cfg (int mode)
__builtin_unreachable (). */
if (EDGE_COUNT (b->preds) == 0
|| (EDGE_COUNT (b->succs) == 0
&& BB_HEAD (b) == BB_END (b)
&& trivially_empty_bb_p (b)
&& single_succ_edge (ENTRY_BLOCK_PTR)->dest != b))
{
c = b->prev_bb;
if (dump_file)
fprintf (dump_file, "Deleting block %i.\n",
b->index);
delete_basic_block (b);
if (!(mode & CLEANUP_CFGLAYOUT))
changed = true;
......
2009-10-26 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/41345
* gcc.dg/pr41345.c: New test.
PR debug/41828
* g++.dg/debug/dwarf2/anonname1.C: New test.
......
/* PR bootstrap/41345 */
/* { dg-do compile } */
/* { dg-options "-O2 -g -fcompare-debug" } */
void
foo (int *x)
{
int a;
for (a = 0; a < 2; a++)
if (x[a])
goto lab;
__builtin_unreachable ();
lab:;
}
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