re PR bootstrap/52808 (LTO bootstrap failed with bootstrap-profiled)
2012-04-03 Richard Guenther <rguenther@suse.de> PR tree-optimization/52808 * tracer.c (tail_duplicate): Return whether we have duplicated any block. (tracer): If we have duplicated any block, cleanup the CFG. * cfghooks.c (duplicate_block): If we duplicated a loop header but not its loop, destroy the loop because it now has multiple entries. * tree-ssa-threadupdate.c (thread_through_loop_header): Tell the cfg manipulation routines we are not creating a multiple entry loop. * gcc.dg/pr52808.c: New testcase. From-SVN: r186104
This commit is contained in:
parent
90b2952fa4
commit
07b1bf209c
|
@ -1,3 +1,16 @@
|
||||||
|
2012-04-03 Richard Guenther <rguenther@suse.de>
|
||||||
|
|
||||||
|
PR tree-optimization/52808
|
||||||
|
* tracer.c (tail_duplicate): Return whether we have duplicated
|
||||||
|
any block.
|
||||||
|
(tracer): If we have duplicated any block, cleanup the CFG.
|
||||||
|
* cfghooks.c (duplicate_block): If we duplicated a loop
|
||||||
|
header but not its loop, destroy the loop because it now has
|
||||||
|
multiple entries.
|
||||||
|
* tree-ssa-threadupdate.c (thread_through_loop_header): Tell
|
||||||
|
the cfg manipulation routines we are not creating a multiple
|
||||||
|
entry loop.
|
||||||
|
|
||||||
2012-04-03 Tristan Gingold <gingold@adacore.com>
|
2012-04-03 Tristan Gingold <gingold@adacore.com>
|
||||||
|
|
||||||
* config/vms/vms-c.c (vms_pragma_nomember_alignment): Handle
|
* config/vms/vms-c.c (vms_pragma_nomember_alignment): Handle
|
||||||
|
|
|
@ -1009,13 +1009,22 @@ duplicate_block (basic_block bb, edge e, basic_block after)
|
||||||
{
|
{
|
||||||
struct loop *cloop = bb->loop_father;
|
struct loop *cloop = bb->loop_father;
|
||||||
struct loop *copy = get_loop_copy (cloop);
|
struct loop *copy = get_loop_copy (cloop);
|
||||||
|
/* If we copied the loop header block but not the loop
|
||||||
|
we have created a loop with multiple entries. Ditch the loop,
|
||||||
|
add the new block to the outer loop and arrange for a fixup. */
|
||||||
|
if (!copy
|
||||||
|
&& cloop->header == bb)
|
||||||
|
{
|
||||||
|
add_bb_to_loop (new_bb, loop_outer (cloop));
|
||||||
|
cloop->header = NULL;
|
||||||
|
cloop->latch = NULL;
|
||||||
|
loops_state_set (LOOPS_NEED_FIXUP);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
add_bb_to_loop (new_bb, copy ? copy : cloop);
|
add_bb_to_loop (new_bb, copy ? copy : cloop);
|
||||||
/* If we copied the loop latch block but not the loop, adjust
|
/* If we copied the loop latch block but not the loop, adjust
|
||||||
loop state.
|
loop state. */
|
||||||
??? If we copied the loop header block but not the loop
|
|
||||||
we might either have created a loop copy or a loop with
|
|
||||||
multiple entries. In both cases we probably have to
|
|
||||||
ditch the loops and arrange for a fixup. */
|
|
||||||
if (!copy
|
if (!copy
|
||||||
&& cloop->latch == bb)
|
&& cloop->latch == bb)
|
||||||
{
|
{
|
||||||
|
@ -1023,6 +1032,7 @@ duplicate_block (basic_block bb, edge e, basic_block after)
|
||||||
loops_state_set (LOOPS_MAY_HAVE_MULTIPLE_LATCHES);
|
loops_state_set (LOOPS_MAY_HAVE_MULTIPLE_LATCHES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new_bb;
|
return new_bb;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2012-04-03 Richard Guenther <rguenther@suse.de>
|
||||||
|
|
||||||
|
PR tree-optimization/52808
|
||||||
|
* gcc.dg/pr52808.c: New testcase.
|
||||||
|
|
||||||
2012-04-03 Jakub Jelinek <jakub@redhat.com>
|
2012-04-03 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
PR tree-optimization/52835
|
PR tree-optimization/52835
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-O -ftracer" } */
|
||||||
|
|
||||||
|
int **fn1 () __attribute__ ((__const__));
|
||||||
|
int main ()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
i = 0;
|
||||||
|
for (;; i++)
|
||||||
|
if (*fn1 ()[i] && !'a' <= 0 && i <= 'z' || *fn1 ()[0] && 'a' <= 'z')
|
||||||
|
return;
|
||||||
|
}
|
18
gcc/tracer.c
18
gcc/tracer.c
|
@ -59,7 +59,6 @@ static bool better_p (const_edge, const_edge);
|
||||||
static edge find_best_successor (basic_block);
|
static edge find_best_successor (basic_block);
|
||||||
static edge find_best_predecessor (basic_block);
|
static edge find_best_predecessor (basic_block);
|
||||||
static int find_trace (basic_block, basic_block *);
|
static int find_trace (basic_block, basic_block *);
|
||||||
static void tail_duplicate (void);
|
|
||||||
|
|
||||||
/* Minimal outgoing edge probability considered for superblock formation. */
|
/* Minimal outgoing edge probability considered for superblock formation. */
|
||||||
static int probability_cutoff;
|
static int probability_cutoff;
|
||||||
|
@ -224,7 +223,7 @@ find_trace (basic_block bb, basic_block *trace)
|
||||||
/* Look for basic blocks in frequency order, construct traces and tail duplicate
|
/* Look for basic blocks in frequency order, construct traces and tail duplicate
|
||||||
if profitable. */
|
if profitable. */
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
tail_duplicate (void)
|
tail_duplicate (void)
|
||||||
{
|
{
|
||||||
fibnode_t *blocks = XCNEWVEC (fibnode_t, last_basic_block);
|
fibnode_t *blocks = XCNEWVEC (fibnode_t, last_basic_block);
|
||||||
|
@ -236,6 +235,7 @@ tail_duplicate (void)
|
||||||
gcov_type cover_insns;
|
gcov_type cover_insns;
|
||||||
int max_dup_insns;
|
int max_dup_insns;
|
||||||
basic_block bb;
|
basic_block bb;
|
||||||
|
bool changed = false;
|
||||||
|
|
||||||
/* Create an oversized sbitmap to reduce the chance that we need to
|
/* Create an oversized sbitmap to reduce the chance that we need to
|
||||||
resize it. */
|
resize it. */
|
||||||
|
@ -332,6 +332,7 @@ tail_duplicate (void)
|
||||||
bb2->index, copy->index, copy->frequency);
|
bb2->index, copy->index, copy->frequency);
|
||||||
|
|
||||||
bb2 = copy;
|
bb2 = copy;
|
||||||
|
changed = true;
|
||||||
}
|
}
|
||||||
mark_bb_seen (bb2);
|
mark_bb_seen (bb2);
|
||||||
bb = bb2;
|
bb = bb2;
|
||||||
|
@ -353,6 +354,8 @@ tail_duplicate (void)
|
||||||
free (trace);
|
free (trace);
|
||||||
free (counts);
|
free (counts);
|
||||||
fibheap_delete (heap);
|
fibheap_delete (heap);
|
||||||
|
|
||||||
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Main entry point to this file. */
|
/* Main entry point to this file. */
|
||||||
|
@ -360,6 +363,8 @@ tail_duplicate (void)
|
||||||
static unsigned int
|
static unsigned int
|
||||||
tracer (void)
|
tracer (void)
|
||||||
{
|
{
|
||||||
|
bool changed;
|
||||||
|
|
||||||
gcc_assert (current_ir_type () == IR_GIMPLE);
|
gcc_assert (current_ir_type () == IR_GIMPLE);
|
||||||
|
|
||||||
if (n_basic_blocks <= NUM_FIXED_BLOCKS + 1)
|
if (n_basic_blocks <= NUM_FIXED_BLOCKS + 1)
|
||||||
|
@ -370,15 +375,14 @@ tracer (void)
|
||||||
dump_flow_info (dump_file, dump_flags);
|
dump_flow_info (dump_file, dump_flags);
|
||||||
|
|
||||||
/* Trace formation is done on the fly inside tail_duplicate */
|
/* Trace formation is done on the fly inside tail_duplicate */
|
||||||
tail_duplicate ();
|
changed = tail_duplicate ();
|
||||||
|
if (changed)
|
||||||
/* FIXME: We really only need to do this when we know tail duplication
|
|
||||||
has altered the CFG. */
|
|
||||||
free_dominance_info (CDI_DOMINATORS);
|
free_dominance_info (CDI_DOMINATORS);
|
||||||
|
|
||||||
if (dump_file)
|
if (dump_file)
|
||||||
dump_flow_info (dump_file, dump_flags);
|
dump_flow_info (dump_file, dump_flags);
|
||||||
|
|
||||||
return 0;
|
return changed ? TODO_cleanup_cfg : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
|
@ -1004,8 +1004,12 @@ thread_through_loop_header (struct loop *loop, bool may_peel_loop_headers)
|
||||||
basic_block *bblocks;
|
basic_block *bblocks;
|
||||||
unsigned nblocks, i;
|
unsigned nblocks, i;
|
||||||
|
|
||||||
/* First handle the case latch edge is redirected. */
|
/* First handle the case latch edge is redirected. We are copying
|
||||||
|
the loop header but not creating a multiple entry loop. Make the
|
||||||
|
cfg manipulation code aware of that fact. */
|
||||||
|
set_loop_copy (loop, loop);
|
||||||
loop->latch = thread_single_edge (latch);
|
loop->latch = thread_single_edge (latch);
|
||||||
|
set_loop_copy (loop, NULL);
|
||||||
gcc_assert (single_succ (loop->latch) == tgt_bb);
|
gcc_assert (single_succ (loop->latch) == tgt_bb);
|
||||||
loop->header = tgt_bb;
|
loop->header = tgt_bb;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue