re PR rtl-optimization/46571 (bootstrap comparison failure in fortran/trans-openmp.c)
authorRichard Henderson <rth@redhat.com>
Sun, 21 Nov 2010 17:19:37 +0000 (09:19 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Sun, 21 Nov 2010 17:19:37 +0000 (09:19 -0800)
PR rtl-optimization/46571
* gcse.c (hash_scan_set): Use next_nonnote_nondebug_insn.
(compute_hash_table_work): Use NONDEBUG_INSN_P.

From-SVN: r167007

gcc/ChangeLog
gcc/gcse.c
gcc/testsuite/gcc.dg/pr46571.c [new file with mode: 0644]

index 285c59c45c3a787ed3405a5a3c2e534e7113cf92..a8113345299b8c73817acb27523b6ff4a1dc2421 100644 (file)
@@ -1,3 +1,9 @@
+2010-11-21  Richard Henderson  <rth@redhat.com>
+
+       PR rtl-optimization/46571
+       * gcse.c (hash_scan_set): Use next_nonnote_nondebug_insn.
+       (compute_hash_table_work): Use NONDEBUG_INSN_P.
+
 2010-11-21  Paul Koning  <ni1d@arrl.net>
 
        * config/mips/pdp11.md (negsi2): Fix wrong code.
index 595fdb2b054ee50c3807146446b2d9c11567a3b1..9ff0da82f1ee4e80ae5249af8bdca3463660fc2b 100644 (file)
@@ -1460,7 +1460,7 @@ hash_scan_set (rtx pat, rtx insn, struct hash_table_d *table)
                  modified.  Here we want to search from INSN+1 on, but
                  oprs_available_p searches from INSN on.  */
               && (insn == BB_END (BLOCK_FOR_INSN (insn))
-                  || (tmp = next_nonnote_insn (insn)) == NULL_RTX
+                  || (tmp = next_nonnote_nondebug_insn (insn)) == NULL_RTX
                   || BLOCK_FOR_INSN (tmp) != BLOCK_FOR_INSN (insn)
                   || oprs_available_p (pat, tmp)))
        insert_set_in_table (pat, insn, table);
@@ -1748,7 +1748,7 @@ compute_hash_table_work (struct hash_table_d *table)
         determine when registers and memory are first and last set.  */
       FOR_BB_INSNS (current_bb, insn)
        {
-         if (! INSN_P (insn))
+         if (!NONDEBUG_INSN_P (insn))
            continue;
 
          if (CALL_P (insn))
@@ -1771,7 +1771,7 @@ compute_hash_table_work (struct hash_table_d *table)
 
       /* The next pass builds the hash table.  */
       FOR_BB_INSNS (current_bb, insn)
-       if (INSN_P (insn))
+       if (NONDEBUG_INSN_P (insn))
          hash_scan_insn (insn, table);
     }
 
diff --git a/gcc/testsuite/gcc.dg/pr46571.c b/gcc/testsuite/gcc.dg/pr46571.c
new file mode 100644 (file)
index 0000000..ac55f49
--- /dev/null
@@ -0,0 +1,122 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcompare-debug" } */
+
+typedef union tree_node *tree;
+typedef unsigned int source_location;
+enum tree_code
+{
+  MINUS_EXPR,
+  MULT_EXPR,
+};
+struct tree_omp_clause
+{
+  union omp_clause_subcode
+  {
+    enum tree_code reduction_code;
+  } subcode;
+};
+union tree_node
+{
+  struct tree_omp_clause omp_clause;
+};
+enum tree_index
+{
+  TI_ERROR_MARK,
+};
+typedef struct
+{
+  unsigned allocatable:1;
+  unsigned dimension:1;
+  unsigned codimension:1;
+  unsigned external:1;
+  unsigned optional:1;
+  unsigned pointer:1;
+  unsigned contiguous:1;
+  unsigned referenced:1;
+} symbol_attribute;
+typedef unsigned int gfc_char_t;
+typedef struct gfc_linebuf
+{
+  source_location location;
+} gfc_linebuf;
+typedef struct
+{
+  gfc_char_t *nextc;
+  gfc_linebuf *lb;
+} locus;
+typedef struct
+{
+  struct gfc_symbol *sym;
+  struct gfc_namelist *next;
+} gfc_namelist;
+enum
+{
+  OMP_LIST_PLUS,
+  OMP_LIST_REDUCTION_FIRST = OMP_LIST_PLUS,
+  OMP_LIST_MULT,
+  OMP_LIST_SUB,
+  OMP_LIST_NUM
+};
+typedef struct gfc_omp_clauses
+{
+  gfc_namelist *lists[OMP_LIST_NUM];
+} gfc_omp_clauses;
+typedef struct gfc_symbol
+{
+  symbol_attribute attr;
+} gfc_symbol;
+typedef struct gfc_code
+{
+  locus loc;
+  union
+  {
+    gfc_omp_clauses *omp_clauses;
+  } ext;
+} gfc_code;
+typedef struct
+{
+} stmtblock_t;
+
+static tree
+gfc_trans_omp_reduction_list (gfc_namelist * namelist, tree list,
+                             enum tree_code reduction_code, locus where)
+{
+  for (; namelist != ((void *) 0); namelist = namelist->next)
+    if (namelist->sym->attr.referenced)
+      {
+       tree node = build_omp_clause (where.lb->location);
+       node->omp_clause.subcode.reduction_code = reduction_code;
+       gfc_trans_omp_array_reduction (namelist->sym, where);
+      }
+}
+
+static tree
+gfc_trans_omp_clauses (stmtblock_t * block, gfc_omp_clauses * clauses,
+                      locus where)
+{
+  tree omp_clauses = (tree) ((void *) 0);
+  int list;
+  for (list = 0; list < OMP_LIST_NUM; list++)
+    {
+      gfc_namelist *n = clauses->lists[list];
+      enum tree_code reduction_code;
+      if (n == ((void *) 0))
+       continue;
+      switch (list)
+       {
+       case OMP_LIST_MULT:
+         reduction_code = MULT_EXPR;
+         break;
+       case OMP_LIST_SUB:
+         reduction_code = MINUS_EXPR;
+       }
+      gfc_trans_omp_reduction_list (n, omp_clauses, reduction_code, where);
+    }
+}
+
+void
+gfc_trans_omp_parallel_workshare (gfc_code * code)
+{
+  stmtblock_t block;
+  gfc_trans_omp_clauses (&block, code->ext.omp_clauses, code->loc);
+}