re PR tree-optimization/32919 (SSA corruption because of abnormal edges and PRE)
authorDaniel Jacobowitz <dan@codesourcery.com>
Wed, 1 Aug 2007 16:53:01 +0000 (16:53 +0000)
committerDaniel Jacobowitz <drow@gcc.gnu.org>
Wed, 1 Aug 2007 16:53:01 +0000 (16:53 +0000)
PR tree-optimization/32919
* tree-ssa-sccvn.c (visit_phi): Do not visit abnormal PHIs.
* tree-ssa-coalesce.c (ssa_conflicts_dump): New.
(coalesce_ssa_name): Call it.

From-SVN: r127132

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr32919.c [new file with mode: 0644]
gcc/tree-ssa-coalesce.c
gcc/tree-ssa-sccvn.c

index 12d7e6782040d9d8e7c2db85492b6a326c3fadf1..9b951a7cdf3e02f176f4994c773a7d4d1ddb8780 100644 (file)
@@ -1,3 +1,10 @@
+2007-08-01  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       PR tree-optimization/32919
+       * tree-ssa-sccvn.c (visit_phi): Do not visit abnormal PHIs.
+       * tree-ssa-coalesce.c (ssa_conflicts_dump): New.
+       (coalesce_ssa_name): Call it.
+
 2007-08-01  Sandra Loosemore  <sandra@codesourcery.com>
            David Ung  <davidu@mips.com>
 
index a6af5f8825ba93a91bded660dfdb67f1b1963860..c2de71481175f6ebec625003ea3decc4c53837bd 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-01  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       PR tree-optimization/32919
+       * gcc.c-torture/compile/pr32919.c: New.
+
 2007-08-01  Nick Clifton  <nickc@redhat.com>
 
        * gcc.c-torture/execute/execute.exp: Change copyright header to
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32919.c b/gcc/testsuite/gcc.c-torture/compile/pr32919.c
new file mode 100644 (file)
index 0000000..33956c8
--- /dev/null
@@ -0,0 +1,26 @@
+void _IO_vfprintf_internal ( char *f )
+{
+  static const void *const step0_jumps[] = { &&do_form_unknown, &&do_flag_plus, &&do_form_float };
+  const void * ptr = step0_jumps[0];
+  do {
+    char spec;
+    spec = (*++f);
+    goto *ptr;
+do_flag_plus:
+     read_int (&f);
+do_number:
+    _itoa_word (spec);
+do_form_float:
+    if (ptr != ((void *)0))
+    {
+      spec = 'x';
+      goto do_number;
+    }
+    if (spec != 'S')
+      __strnlen ();
+    return;
+    do_form_unknown:;
+  }
+  while (*f != '\0');
+}
+
index 4e3a5a3df83f96de061ed2c23ce69a308ba423ab..1b63635881bdec7e584a85b9b48e656b4884351f 100644 (file)
@@ -589,6 +589,24 @@ ssa_conflicts_merge (ssa_conflicts_p ptr, unsigned x, unsigned y)
 }
 
 
+/* Dump a conflicts graph.  */
+
+static void
+ssa_conflicts_dump (FILE *file, ssa_conflicts_p ptr)
+{
+  unsigned x;
+
+  fprintf (file, "\nConflict graph:\n");
+
+  for (x = 0; x < ptr->size; x++)
+    if (ptr->conflicts[x])
+      {
+       fprintf (dump_file, "%d: ", x);
+       dump_bitmap (file, ptr->conflicts[x]);
+      }
+}
+
+
 /* This structure is used to efficiently record the current status of live 
    SSA_NAMES when building a conflict graph.  
    LIVE_BASE_VAR has a bit set for each base variable which has at least one
@@ -1302,6 +1320,8 @@ coalesce_ssa_name (void)
   /* Build a conflict graph.  */
   graph = build_ssa_conflict_graph (liveinfo);
   delete_tree_live_info (liveinfo);
+  if (dump_file && (dump_flags & TDF_DETAILS))
+    ssa_conflicts_dump (dump_file, graph);
 
   sort_coalesce_list (cl);
 
index 607cd1d298ccc7d15d43952bfc09a7bbd3d718eb..5e6a86a4b6c3c19811d8dcc57a77d7419c05443f 100644 (file)
@@ -1259,6 +1259,11 @@ visit_phi (tree phi)
   bool allsame = true;
   int i;
 
+  /* TODO: We could check for this in init_sccvn, and replace this
+     with a gcc_assert.  */
+  if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (PHI_RESULT (phi)))
+    return set_ssa_val_to (PHI_RESULT (phi), PHI_RESULT (phi));
+
   /* See if all non-TOP arguments have the same value.  TOP is
      equivalent to everything, so we can ignore it.  */
   for (i = 0; i < PHI_NUM_ARGS (phi); i++)