* dominance.c (recount_dominator): Handle postdominators.
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Mar 2004 00:28:07 +0000 (00:28 +0000)
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Mar 2004 00:28:07 +0000 (00:28 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@78734 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/dominance.c

index f439fa0..3661aa8 100644 (file)
@@ -1,3 +1,7 @@
+2004-03-02  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>
+
+       * dominance.c (recount_dominator): Handle postdominators.
+
 2004-03-01  Richard Sandiford  <rsandifo@redhat.com>
 
        * config/mips/mips-protos.h (enum mips_symbol_type): Move from mips.h.
index d608391..2b6e806 100644 (file)
@@ -769,23 +769,38 @@ verify_dominators (enum cdi_direction dir)
     abort ();
 }
 
-/* Recount dominator of BB.  */
+/* Determine immediate dominator (or postdominator, according to DIR) of BB,
+   assuming that dominators of other blocks are correct.  We also use it to
+   recompute the dominators in a restricted area, by iterating it until it
+   reaches a fixpoint.  */
+
 basic_block
 recount_dominator (enum cdi_direction dir, basic_block bb)
 {
-   basic_block dom_bb = NULL;
-   edge e;
+  basic_block dom_bb = NULL;
+  edge e;
 
   if (!dom_computed[dir])
     abort ();
 
-   for (e = bb->pred; e; e = e->pred_next)
-     {
-       if (!dominated_by_p (dir, e->src, bb))
-         dom_bb = nearest_common_dominator (dir, dom_bb, e->src);
-     }
+  if (dir == CDI_DOMINATORS)
+    {
+      for (e = bb->pred; e; e = e->pred_next)
+       {
+         if (!dominated_by_p (dir, e->src, bb))
+           dom_bb = nearest_common_dominator (dir, dom_bb, e->src);
+       }
+    }
+  else
+    {
+      for (e = bb->succ; e; e = e->succ_next)
+       {
+         if (!dominated_by_p (dir, e->dest, bb))
+           dom_bb = nearest_common_dominator (dir, dom_bb, e->dest);
+       }
+    }
 
-   return dom_bb;
+  return dom_bb;
 }
 
 /* Iteratively recount dominators of BBS. The change is supposed to be local