Patchwork 01/03: Bail out immediately with wrong dominance updates

login
register
mail settings
Submitter Andrey Belevantsev
Date Oct. 4, 2010, 3:38 p.m.
Message ID <4CA9F50A.6050409@ispras.ru>
Download mbox | patch
Permalink /patch/66702/
State New
Headers show

Comments

Andrey Belevantsev - Oct. 4, 2010, 3:38 p.m.
Hello,

This patch by Zdenek bails out immediately when a dominance update is 
performed on a control flow with unreachable basic blocks.  Bootstrapped 
together with the other patches for 43603, ok for trunk?

	2010-10-04  Zdenek Dvorak  <rakdver@kam.mff.cuni.cz>
	* et-forest.c (et_nca): Return NULL immediately when the dominance forest
	has disjoint components.
Richard Guenther - Oct. 4, 2010, 3:43 p.m.
2010/10/4 Andrey Belevantsev <abel@ispras.ru>:
> Hello,
>
> This patch by Zdenek bails out immediately when a dominance update is
> performed on a control flow with unreachable basic blocks.  Bootstrapped
> together with the other patches for 43603, ok for trunk?

Ok.

Thanks,
Richard.

>        2010-10-04  Zdenek Dvorak  <rakdver@kam.mff.cuni.cz>
>        * et-forest.c (et_nca): Return NULL immediately when the dominance
> forest
>        has disjoint components.
>
>
>

Patch

diff --git a/gcc/et-forest.c b/gcc/et-forest.c
index c15b6d8..94757c0 100644
--- a/gcc/et-forest.c
+++ b/gcc/et-forest.c
@@ -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)
     {