et-forest.c (et_nca): Return NULL immediately when the dominance forest has disjoint...
authorZdenek Dvorak <rakdver@kam.uniff.cz>
Thu, 14 Oct 2010 07:08:45 +0000 (09:08 +0200)
committerAndrey Belevantsev <abel@gcc.gnu.org>
Thu, 14 Oct 2010 07:08:45 +0000 (11:08 +0400)
2010-10-14  Zdenek Dvorak  <rakdver@kam.uniff.cz>
        * et-forest.c (et_nca): Return NULL immediately when
        the dominance forest has disjoint components.

From-SVN: r165451

gcc/ChangeLog
gcc/et-forest.c

index cb07b23..d567d60 100644 (file)
@@ -1,3 +1,7 @@
+2010-10-14  Zdenek Dvorak  <rakdver@kam.uniff.cz>
+       * et-forest.c (et_nca): Return NULL immediately when
+       the dominance forest has disjoint components.
+
 2010-10-13  Vladimir Makarov  <vmakarov@redhat.com>
 
        * ira.c (setup_class_hard_regs): Fix typo in indexing
index c15b6d8..94757c0 100644 (file)
@@ -661,7 +661,7 @@ et_nca (struct et_node *n1, struct et_node *n2)
       if (r)
        r->parent = o1;
     }
-  else
+  else if (r == o2 || (r && r->parent != NULL))
     {
       ret = o2->prev;
 
@@ -669,6 +669,15 @@ et_nca (struct et_node *n1, struct et_node *n2)
       if (l)
        l->parent = o1;
     }
+  else
+    {
+      /* O1 and O2 are in different components of the forest.  */
+      if (l)
+       l->parent = o1;
+      if (r)
+       r->parent = o1;
+      return NULL;
+    }
 
   if (0 < o2->depth)
     {