static void
bitmap_union_of_preds_with_entry (sbitmap dst, sbitmap *src, basic_block b)
{
- unsigned int set_size = dst->size;
- edge e;
- unsigned ix;
-
- for (ix = 0; ix < EDGE_COUNT (b->preds); ix++)
+ /* Handle case with no predecessors (including ENTRY block). */
+ if (EDGE_COUNT (b->preds) == 0)
{
- e = EDGE_PRED (b, ix);
- bitmap_copy (dst, src[e->src->index]);
- break;
+ bitmap_clear (dst);
+ return;
}
- if (ix == EDGE_COUNT (b->preds))
- bitmap_clear (dst);
- else
- for (ix++; ix < EDGE_COUNT (b->preds); ix++)
- {
- unsigned int i;
- SBITMAP_ELT_TYPE *p, *r;
-
- e = EDGE_PRED (b, ix);
- p = src[e->src->index]->elms;
- r = dst->elms;
- for (i = 0; i < set_size; i++)
- *r++ |= *p++;
- }
+ edge e;
+ edge_iterator ei;
+ /* Union remaining predecessors' bitmaps. */
+ FOR_EACH_EDGE (e, ei, b->preds)
+ {
+ /* Initialize with first predecessor's bitmap. */
+ if (ei.index == 0)
+ {
+ bitmap_copy (dst, src[e->src->index]);
+ continue;
+ }
+
+ /* Perform bitmap OR operation element-wise. */
+ bitmap_ior (dst, dst, src[e->src->index]);
+ }
}
/* Compute the reaching definition in and out based on the gen and KILL