[PATCH] factor out generic (de)initialization of ANTIC and AVAIL in PRE

Daniel Berlin dberlin@dberlin.org
Wed Jun 18 19:36:00 GMT 2008


On Wed, Jun 18, 2008 at 3:18 PM, Bernhard Fischer <rep.dot.nop@gmail.com> wrote:
> Hi,
>
> The attached patch factors the (de)initialization of ANTIC and AVAIL
> sets used by PRE into init_antic() and fini_antic().
>
> The patch was bootstrapped and regtested with languages=c,fortran on
> i686 with no regressions.
> OK for trunk?
+static bool
+bitmap_set_empty_p (const bitmap_set_t set)
+{
+  return !((set->values && !bitmap_empty_p (set->values))
+         && (set->expressions && !bitmap_empty_p (set->expressions)));

Uh, why not "!set->values || bitmap_empty_p (set->values) ||
!set->expressions || bitmap_empty_p (set->expressions)"

(IE the not in front of the things and the && are confusing to me)


+static void
+bitmap_set_ior_into (bitmap_set_t dest, bitmap_set_t orig)
+{
+  if (dest != orig)
+    {
+      bitmap_ior_into (dest->values, orig->values);
+      bitmap_ior_into (dest->expressions, orig->expressions);
+    }
+}

This isn't right.

The bitmap sets maintain the invariant that only one leader for a
given value exists in the set.

IE it is not possible to have a set like so:

ANTIC_IN[5] = { a_3 (VH.4), b_7 (VH.4) }

(Note that both are leaders for the value 4).

Your bitmap_ior will break this invariant.

The code is carefully written to maintain this invariant (This is why
there are things like bitmap_insert_into_set for places we know don't
have a leader, and bitmap_value_insert_into_set for places where we
don't).


The correct way to ior the sets is to do either:
1. Assuming you want leaders in dest to not be overridden by leaders in src
for each expression in src
if !bitmap_set_contains_value (dest)
  bitmap_insert_into_set(dest, expression)

2.  Assuming you want leaders in dest to be overridden by leaders in src
For each expression in src
bitmap_value_replace_into_set (dest, expression):


This is a "value-wise" union.
This is what the code

* Then union in the ANTIC_OUT - TMP_GEN values,
     to get ANTIC_OUT U EXP_GEN - TMP_GEN */
  FOR_EACH_EXPR_ID_IN_SET (S, bii, bi)
    bitmap_value_insert_into_set (ANTIC_IN (block),
                                  expression_for_id (bii));


Is doing.



More information about the Gcc-patches mailing list