tree-ssa-pre.c (bitmap_set_and): Avoid bitmap copy.

2017-05-08  Richard Biener  <rguenther@suse.de>

	* tree-ssa-pre.c (bitmap_set_and): Avoid bitmap copy.
	(bitmap_set_subtract_values): Likewise.

From-SVN: r247739
This commit is contained in:
Richard Biener 2017-05-08 13:35:29 +00:00 committed by Richard Biener
parent da11a720a3
commit a92464ddb2
2 changed files with 26 additions and 15 deletions

View File

@ -1,3 +1,8 @@
2017-05-08 Richard Biener <rguenther@suse.de>
* tree-ssa-pre.c (bitmap_set_and): Avoid bitmap copy.
(bitmap_set_subtract_values): Likewise.
2017-05-08 Richard Biener <rguenther@suse.de>
* tree-vrp.c (gimple_assign_nonzero_warnv_p): Rename to ...

View File

@ -817,19 +817,23 @@ bitmap_set_and (bitmap_set_t dest, bitmap_set_t orig)
if (dest != orig)
{
bitmap_head temp;
bitmap_initialize (&temp, &grand_bitmap_obstack);
bitmap_and_into (&dest->values, &orig->values);
bitmap_copy (&temp, &dest->expressions);
EXECUTE_IF_SET_IN_BITMAP (&temp, 0, i, bi)
unsigned int to_clear = -1U;
FOR_EACH_EXPR_ID_IN_SET (dest, i, bi)
{
if (to_clear != -1U)
{
bitmap_clear_bit (&dest->expressions, to_clear);
to_clear = -1U;
}
pre_expr expr = expression_for_id (i);
unsigned int value_id = get_expr_value_id (expr);
if (!bitmap_bit_p (&dest->values, value_id))
bitmap_clear_bit (&dest->expressions, i);
to_clear = i;
}
bitmap_clear (&temp);
if (to_clear != -1U)
bitmap_clear_bit (&dest->expressions, to_clear);
}
}
@ -862,18 +866,20 @@ bitmap_set_subtract_values (bitmap_set_t a, bitmap_set_t b)
{
unsigned int i;
bitmap_iterator bi;
bitmap_head temp;
bitmap_initialize (&temp, &grand_bitmap_obstack);
bitmap_copy (&temp, &a->expressions);
EXECUTE_IF_SET_IN_BITMAP (&temp, 0, i, bi)
pre_expr to_remove = NULL;
FOR_EACH_EXPR_ID_IN_SET (a, i, bi)
{
if (to_remove)
{
bitmap_remove_from_set (a, to_remove);
to_remove = NULL;
}
pre_expr expr = expression_for_id (i);
if (bitmap_set_contains_value (b, get_expr_value_id (expr)))
bitmap_remove_from_set (a, expr);
to_remove = expr;
}
bitmap_clear (&temp);
if (to_remove)
bitmap_remove_from_set (a, to_remove);
}