http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52340

             Bug #: 52340
           Summary: autopar (at least) corrupts dominance info
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: rgue...@gcc.gnu.org


Adding sanity-checking to calculate_dominance_info trips over autopar at least:

Index: gcc/dominance.c
===================================================================
--- gcc/dominance.c     (revision 184460)
+++ gcc/dominance.c     (working copy)
@@ -639,7 +639,12 @@ calculate_dominance_info (enum cdi_direc
   bool reverse = (dir == CDI_POST_DOMINATORS) ? true : false;

   if (dom_computed[dir_index] == DOM_OK)
-    return;
+    {
+#ifdef ENABLE_CHECKING
+      verify_dominators (dir);
+#endif
+      return;
+    }

   timevar_push (TV_DOMINANCE);
   if (!dom_info_available_p (dir))
@@ -667,6 +672,10 @@ calculate_dominance_info (enum cdi_direc
       free_dom_info (&di);
       dom_computed[dir_index] = DOM_NO_FAST_QUERY;
     }
+#ifdef ENABLE_CHECKING
+  else
+    verify_dominators (dir);
+#endif

   compute_dom_fast_query (dir);


We notice this in the update_ssa call that computes dominance info
(which is already there, so the verification happens and fails).
A workaround (or fix) for pieces is

Index: gcc/tree-parloops.c
===================================================================
--- gcc/tree-parloops.c (revision 184460)
+++ gcc/tree-parloops.c (working copy)
@@ -1740,6 +1740,10 @@ create_parallel_loop (struct loop *loop,
   gimple_set_location (stmt, loc);
   gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);

+  /* After the above dom info is hosed.  Re-compute it.  */
+  free_dominance_info (CDI_DOMINATORS);
+  calculate_dominance_info (CDI_DOMINATORS);
+
   return paral_bb;
 }

Reply via email to