Skip to content

Commit

Permalink
Loop over intersected bitmaps.
Browse files Browse the repository at this point in the history
compute_ranges_in_block loops over the import list and then checks the
same bit in exports.  It is nmore efficent to loop over the intersection
of the 2 bitmaps.

	PR tree-optimization/106514
	* gimple-range-path.cc (path_range_query::compute_ranges_in_block):
	Use EXECUTE_IF_AND_IN_BITMAP to loop over 2 bitmaps.
  • Loading branch information
andrewwmacleod committed Aug 4, 2022
1 parent be58bf9 commit 8e34d92
Showing 1 changed file with 18 additions and 22 deletions.
40 changes: 18 additions & 22 deletions gcc/gimple-range-path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -479,32 +479,28 @@ path_range_query::compute_ranges_in_block (basic_block bb)
p->set_root_oracle (nullptr);
}

EXECUTE_IF_SET_IN_BITMAP (m_imports, 0, i, bi)
gori_compute &g = m_ranger->gori ();
bitmap exports = g.exports (bb);
EXECUTE_IF_AND_IN_BITMAP (m_imports, exports, 0, i, bi)
{
tree name = ssa_name (i);
gori_compute &g = m_ranger->gori ();
bitmap exports = g.exports (bb);

if (bitmap_bit_p (exports, i))
Value_Range r (TREE_TYPE (name));
if (g.outgoing_edge_range_p (r, e, name, *this))
{
Value_Range r (TREE_TYPE (name));
if (g.outgoing_edge_range_p (r, e, name, *this))
Value_Range cached_range (TREE_TYPE (name));
if (get_cache (cached_range, name))
r.intersect (cached_range);

set_cache (r, name);
if (DEBUG_SOLVER)
{
Value_Range cached_range (TREE_TYPE (name));
if (get_cache (cached_range, name))
r.intersect (cached_range);

set_cache (r, name);
if (DEBUG_SOLVER)
{
fprintf (dump_file, "outgoing_edge_range_p for ");
print_generic_expr (dump_file, name, TDF_SLIM);
fprintf (dump_file, " on edge %d->%d ",
e->src->index, e->dest->index);
fprintf (dump_file, "is ");
r.dump (dump_file);
fprintf (dump_file, "\n");
}
fprintf (dump_file, "outgoing_edge_range_p for ");
print_generic_expr (dump_file, name, TDF_SLIM);
fprintf (dump_file, " on edge %d->%d ",
e->src->index, e->dest->index);
fprintf (dump_file, "is ");
r.dump (dump_file);
fprintf (dump_file, "\n");
}
}
}
Expand Down

0 comments on commit 8e34d92

Please sign in to comment.