Hi,

> Though conditional const information "r684 <- 0" is collected by
> find_implicit_sets, the conditional information is recorded as local
> information of bb 97, and it is not recorded in avout of bb 96, so not
> in avin of bb 97 either.

To have the set in avout of bb 96 would be wrong because the set is
only available on the edge from bb 96 to bb 97, but not on the edge
from bb 96 to bb 47.

What should be done about this, is to add the implicit sets to AVIN of
the block that the implicit set is recorded for. You have to do this
after calling lcm.c's compute_available() because the normal
"available expressions" problem in its basic block based form cannot
handle implicit sets. I think something like the patch below
(completely untested, of course ;-) will be necessary to fix this
problem.

If you file a PR with a test case, and assign it to me, I'll have a
closer look and I'll see if I can come up with a proper patch.

Ciao!
Steven



Index: cprop.c
===================================================================
--- cprop.c     (revision 179480)
+++ cprop.c     (working copy)
@@ -641,9 +641,33 @@
 static void
 compute_cprop_data (void)
 {
+  basic_block bb;
+
   compute_local_properties (cprop_absaltered, cprop_pavloc, &set_hash_table);
   compute_available (cprop_pavloc, cprop_absaltered,
                     cprop_avout, cprop_avin);
+
+  /* Merge implicit sets into CPROP_AVIN.  Implicit sets are always
+     available at the head of the basic block they are recorded for.  */
+  FOR_EACH_BB (bb)
+    {
+      if (implicit_sets[bb->index] != NULL_RTX)
+       {
+         rtx implicit_set = implicit_sets[bb->index];
+         int regno = REGNO (SET_DEST (implicit_set));
+         struct expr *set = lookup_set (regno, &set_hash_table);
+
+         /* Find the set that is computed in BB.  */
+         while (set)
+           {
+             if (TEST_BIT (cprop_pavloc[bb->index], set->bitmap_index))
+               break;
+             set = next_set (regno, set);
+           }
+         gcc_assert (set);
+         SET_BIT (cprop_avin[bb->index], set->bitmap_index);
+       }
+    }
 }
 ♀
 /* Copy/constant propagation.  */

Reply via email to