This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: bug in dominance algorithm


Hi,

On Mon, 18 Jun 2001, Michael Matz wrote:

dumb stuff like:

> Hmm, below is a patch (only the essential parts) to do something like

Which patch you ask?

This one:
-- 
Index: dominance.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dominance.c,v
retrieving revision 1.1
diff -u -r1.1 dominance.c
--- dominance.c	2000/11/14 09:58:40	1.1
+++ dominance.c	2001/06/18 02:22:11
@@ -327,13 +327,15 @@
       int i;
       for (i = n_basic_blocks - 1; i >= 0; i--)
 	{
+	  unsigned int new_root;
 	  basic_block b = BASIC_BLOCK (i);
 	  if (di->dfs_order[b->index])
 	    continue;
-	  di->dfs_order[b->index] = di->dfsnum;
+	  di->dfs_order[b->index] = new_root = di->dfsnum;
 	  di->dfs_to_bb[di->dfsnum] = b;
 	  di->dfsnum++;
 	  calc_dfs_tree_nonrec (di, b, reverse);
+	  di->dfs_parent[new_root] = di->dfs_order[n_basic_blocks];
 	}
     }

@@ -562,13 +564,13 @@
 	     If it is a child of ENTRY_BLOCK that's OK, and it's only
 	     dominated by itself; if it's _not_ a child of ENTRY_BLOCK, it
 	     means, it is unreachable.  That case has been disallowed in the
-	     building of the DFS tree, so we are save here.  For the reverse
+	     building of the DFS tree, so we are safe here.  For the reverse
 	     flow graph it means, it has no children, so, to be compatible
 	     with the old code, we set the post_dominators to all one.  */
-	  if (!di->dom[i])
+	  /*if (!di->dom[i])
 	    {
 	      sbitmap_ones (dominators[bb]);
-	    }
+	    }*/
 	}
       SET_BIT (dominators[bb], bb);
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]