bitmap.c (bitmap_last_set_bit): Rewrite to return the correct bit.

* bitmap.c (bitmap_last_set_bit): Rewrite to return the correct bit.

	* graphite.c (print_global_statistics): Use EDGE_COUNT instead
	of VEC_length.
	(print_graphite_scop_statistics): Likewise.
	* graphite-scop-detection.c (get_bb_type): Use single_succ_p.
	(print_graphite_scop_statistics): Use EDGE_COUNT, not VEC_length.
	(canonicalize_loop_closed_ssa): Use single_pred_p.

	* alias.c (reg_seen): Make this an sbitmap.
	(record_set, init_alias_analysis): Update.

	* tree-ssa-coalesce.c (ssa_conflicts_dump): Fix dumping.

From-SVN: r191063
This commit is contained in:
Steven Bosscher 2012-09-07 10:23:06 +00:00
parent 183c7727f2
commit d630245f9d
6 changed files with 44 additions and 39 deletions

View File

@ -1,3 +1,19 @@
2012-09-07 Steven Bosscher <steven@gcc.gnu.org>
* bitmap.c (bitmap_last_set_bit): Rewrite to return the correct bit.
* graphite.c (print_global_statistics): Use EDGE_COUNT instead
of VEC_length.
(print_graphite_scop_statistics): Likewise.
* graphite-scop-detection.c (get_bb_type): Use single_succ_p.
(print_graphite_scop_statistics): Use EDGE_COUNT, not VEC_length.
(canonicalize_loop_closed_ssa): Use single_pred_p.
* alias.c (reg_seen): Make this an sbitmap.
(record_set, init_alias_analysis): Update.
* tree-ssa-coalesce.c (ssa_conflicts_dump): Fix dumping.
2012-09-07 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/53986

View File

@ -1220,7 +1220,7 @@ find_base_value (rtx src)
/* While scanning insns to find base values, reg_seen[N] is nonzero if
register N has been set in this function. */
static char *reg_seen;
static sbitmap reg_seen;
static void
record_set (rtx dest, const_rtx set, void *data ATTRIBUTE_UNUSED)
@ -1246,7 +1246,7 @@ record_set (rtx dest, const_rtx set, void *data ATTRIBUTE_UNUSED)
{
while (--n >= 0)
{
reg_seen[regno + n] = 1;
SET_BIT (reg_seen, regno + n);
new_reg_base_value[regno + n] = 0;
}
return;
@ -1267,12 +1267,12 @@ record_set (rtx dest, const_rtx set, void *data ATTRIBUTE_UNUSED)
else
{
/* There's a REG_NOALIAS note against DEST. */
if (reg_seen[regno])
if (TEST_BIT (reg_seen, regno))
{
new_reg_base_value[regno] = 0;
return;
}
reg_seen[regno] = 1;
SET_BIT (reg_seen, regno);
new_reg_base_value[regno] = unique_base_value (unique_id++);
return;
}
@ -1328,10 +1328,10 @@ record_set (rtx dest, const_rtx set, void *data ATTRIBUTE_UNUSED)
}
/* If this is the first set of a register, record the value. */
else if ((regno >= FIRST_PSEUDO_REGISTER || ! fixed_regs[regno])
&& ! reg_seen[regno] && new_reg_base_value[regno] == 0)
&& ! TEST_BIT (reg_seen, regno) && new_reg_base_value[regno] == 0)
new_reg_base_value[regno] = find_base_value (src);
reg_seen[regno] = 1;
SET_BIT (reg_seen, regno);
}
/* Return REG_BASE_VALUE for REGNO. Selective scheduler uses this to avoid
@ -2789,7 +2789,7 @@ init_alias_analysis (void)
VEC_safe_grow_cleared (rtx, gc, reg_base_value, maxreg);
new_reg_base_value = XNEWVEC (rtx, maxreg);
reg_seen = XNEWVEC (char, maxreg);
reg_seen = sbitmap_alloc (maxreg);
/* The basic idea is that each pass through this loop will use the
"constant" information from the previous pass to propagate alias
@ -2834,7 +2834,7 @@ init_alias_analysis (void)
memset (new_reg_base_value, 0, maxreg * sizeof (rtx));
/* Wipe the reg_seen array clean. */
memset (reg_seen, 0, maxreg);
sbitmap_zero (reg_seen);
/* Mark all hard registers which may contain an address.
The stack, frame and argument pointers may contain an address.
@ -2957,7 +2957,7 @@ init_alias_analysis (void)
/* Clean up. */
free (new_reg_base_value);
new_reg_base_value = 0;
free (reg_seen);
sbitmap_free (reg_seen);
reg_seen = 0;
timevar_pop (TV_ALIAS_ANALYSIS);
}

View File

@ -837,33 +837,24 @@ bitmap_last_set_bit (const_bitmap a)
gcc_unreachable ();
found_bit:
bit_no += ix * BITMAP_WORD_BITS;
/* Binary search for the last set bit. */
#if GCC_VERSION >= 3004
gcc_assert (sizeof(long) == sizeof (word));
bit_no += sizeof (long) * 8 - __builtin_ctzl (word);
bit_no += BITMAP_WORD_BITS - __builtin_clzl (word) - 1;
#else
#if BITMAP_WORD_BITS > 64
#error "Fill out the table."
#endif
/* Hopefully this is a twos-complement host... */
BITMAP_WORD x = word;
x |= (x >> 1);
x |= (x >> 2);
x |= (x >> 4);
x |= (x >> 8);
x |= (x >> 16);
#if BITMAP_WORD_BITS > 32
if ((word & 0xffffffff00000000))
word >>= 32, bit_no += 32;
x |= (x >> 32);
#endif
if (word & 0xffff0000)
word >>= 16, bit_no += 16;
if (!(word & 0xff00))
word >>= 8, bit_no += 8;
if (!(word & 0xf0))
word >>= 4, bit_no += 4;
if (!(word & 12))
word >>= 2, bit_no += 2;
if (!(word & 2))
word >>= 1, bit_no += 1;
bit_no += bitmap_popcount (x) - 1;
#endif
gcc_checking_assert (word & 1);
return bit_no;
return bit_no;
}

View File

@ -67,7 +67,7 @@ static gbb_type
get_bb_type (basic_block bb, struct loop *last_loop)
{
VEC (basic_block, heap) *dom;
int nb_dom, nb_suc;
int nb_dom;
struct loop *loop = bb->loop_father;
/* Check, if we entry into a new loop. */
@ -88,9 +88,7 @@ get_bb_type (basic_block bb, struct loop *last_loop)
if (nb_dom == 0)
return GBB_LAST;
nb_suc = VEC_length (edge, bb->succs);
if (nb_dom == 1 && nb_suc == 1)
if (nb_dom == 1 && single_succ_p (bb))
return GBB_SIMPLE;
return GBB_COND_HEADER;
@ -1114,7 +1112,7 @@ print_graphite_scop_statistics (FILE* file, scop_p scop)
n_bbs++;
n_p_bbs += bb->count;
if (VEC_length (edge, bb->succs) > 1)
if (EDGE_COUNT (bb->succs) > 1)
{
n_conditions++;
n_p_conditions += bb->count;
@ -1299,7 +1297,7 @@ canonicalize_loop_closed_ssa (loop_p loop)
bb = e->dest;
if (VEC_length (edge, bb->preds) == 1)
if (single_pred_p (bb))
{
e = split_block_after_labels (bb);
make_close_phi_nodes_unique (e->src);

View File

@ -97,7 +97,7 @@ print_global_statistics (FILE* file)
n_p_loops += bb->count;
}
if (VEC_length (edge, bb->succs) > 1)
if (EDGE_COUNT (bb->succs) > 1)
{
n_conditions++;
n_p_conditions += bb->count;
@ -149,7 +149,7 @@ print_graphite_scop_statistics (FILE* file, scop_p scop)
n_bbs++;
n_p_bbs += bb->count;
if (VEC_length (edge, bb->succs) > 1)
if (EDGE_COUNT (bb->succs) > 1)
{
n_conditions++;
n_p_conditions += bb->count;

View File

@ -626,10 +626,10 @@ ssa_conflicts_dump (FILE *file, ssa_conflicts_p ptr)
fprintf (file, "\nConflict graph:\n");
FOR_EACH_VEC_ELT (bitmap, ptr->conflicts, x, b);
FOR_EACH_VEC_ELT (bitmap, ptr->conflicts, x, b)
if (b)
{
fprintf (dump_file, "%d: ", x);
fprintf (file, "%d: ", x);
dump_bitmap (file, b);
}
}