This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[tuples] more openmp regression squashing


This knocks a couple dozen regressions.  Yay progress.

	* omp-low.c (check_omp_nesting_restrictions): Fetch clauses from for.
	(expand_omp_atomic): Parse GIMPLE_OMP_ATOMIC correctly.
	(lower_omp_single_simple): Create GIMPLE_COND with both tlabel and
	flabel.
	(lower_omp_for): Make sure we have a body before look inside.
	* gimple-low.c (lower_stmt): Add case for GIMPLE_OMP_SECTIONS_SWITCH.
	* gimple-pretty-print.c (dump_gimple_omp_single): New.
	(dump_gimple_stmt): Add case for GIMPLE_OMP_SINGLE.
	* gimplify.c (gimplify_omp_workshare): Remove fixme.  Enable code.
	* gimple.c (gss_for_code): Add case for GIMPLE_OMP_{RETURN,
	SECTIONS_SWITCH}.
	(gimple_regimplify_operands):  Do not regimplify GIMPLE_ASM
	operands.  Do not look inside empty operands.
	* gimple.h (is_gimple_omp): Fix typo for GIMPLE_OMP_ATOMIC*.
	* tree-cfg.c (make_edges): Rename OMP_SECTION to GIMPLE_OMP_SECTION.

Index: omp-low.c
===================================================================
--- omp-low.c	(revision 135322)
+++ omp-low.c	(working copy)
@@ -1375,7 +1375,7 @@ check_omp_nesting_restrictions (gimple  
 			"of critical region");
 	    return;
 	  case GIMPLE_OMP_FOR:
-	    if (find_omp_clause (gimple_omp_parallel_clauses (ctx->stmt),
+	    if (find_omp_clause (gimple_omp_for_clauses (ctx->stmt),
 				 OMP_CLAUSE_ORDERED) == NULL)
 	      warning (0, "ordered region must be closely nested inside "
 			  "a loop region with an ordered clause");
@@ -4055,9 +4055,9 @@ expand_omp_atomic (struct omp_region *re
 {
   basic_block load_bb = region->entry, store_bb = region->exit;
   gimple load = last_stmt (load_bb), store = last_stmt (store_bb);
-  tree loaded_val = gimple_assign_lhs (load);
-  tree addr = gimple_assign_rhs1 (load);
-  tree stored_val = gimple_assign_lhs (store);
+  tree loaded_val = gimple_omp_atomic_load_lhs (load);
+  tree addr = gimple_omp_atomic_load_rhs (load);
+  tree stored_val = gimple_omp_atomic_store_val (store);
   tree type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr)));
   HOST_WIDE_INT index;
 
@@ -4458,6 +4458,7 @@ lower_omp_sections (gimple_stmt_iterator
 static void
 lower_omp_single_simple (gimple single_stmt, gimple_seq *pre_p)
 {
+  tree tlabel = create_artificial_label ();
   tree flabel = create_artificial_label ();
   gimple call, cond;
   tree lhs;
@@ -4466,8 +4467,10 @@ lower_omp_single_simple (gimple single_s
   call = gimple_build_call (built_in_decls[BUILT_IN_GOMP_SINGLE_START], 0);
   gimple_call_set_lhs (call, lhs);
   gimple_seq_add_stmt (pre_p, call);
-  cond = gimple_build_cond (NE_EXPR, lhs, boolean_true_node, flabel, NULL);
+
+  cond = gimple_build_cond (EQ_EXPR, lhs, boolean_true_node, tlabel, flabel);
   gimple_seq_add_stmt (pre_p, cond);
+  gimple_seq_add_stmt (pre_p, gimple_build_label (tlabel));
   gimple_seq_add_seq (pre_p, gimple_omp_body (single_stmt));
   gimple_seq_add_stmt (pre_p, gimple_build_label (flabel));
 }
@@ -4829,7 +4832,8 @@ lower_omp_for (gimple_stmt_iterator *gsi
   /* Move declaration of temporaries in the loop body before we make
      it go away.  */
   omp_for_body = gimple_omp_body (stmt);
-  if (gimple_code (gimple_seq_first_stmt (omp_for_body)) == GIMPLE_BIND)
+  if (!gimple_seq_empty_p (omp_for_body)
+      && gimple_code (gimple_seq_first_stmt (omp_for_body)) == GIMPLE_BIND)
     record_vars_into (gimple_bind_vars (gimple_seq_first_stmt (omp_for_body)),
 		      ctx->cb.dst_fn);
 
Index: gimple-low.c
===================================================================
--- gimple-low.c	(revision 135313)
+++ gimple-low.c	(working copy)
@@ -299,6 +299,7 @@ lower_stmt (gimple_stmt_iterator *gsi, s
     case GIMPLE_CHANGE_DYNAMIC_TYPE:
     case GIMPLE_OMP_FOR:
     case GIMPLE_OMP_SECTIONS:
+    case GIMPLE_OMP_SECTIONS_SWITCH:
     case GIMPLE_OMP_SECTION:
     case GIMPLE_OMP_SINGLE:
     case GIMPLE_OMP_MASTER:
Index: gimple-pretty-print.c
===================================================================
--- gimple-pretty-print.c	(revision 135313)
+++ gimple-pretty-print.c	(working copy)
@@ -782,6 +782,34 @@ dump_gimple_omp_continue (pretty_printer
     }
 }
 
+/* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER.  */
+
+static void
+dump_gimple_omp_single (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+  if (flags & TDF_RAW)
+    {
+      dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
+		       gimple_omp_body (gs));
+      dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags);
+      dump_gimple_fmt (buffer, spc, flags, " >");
+    }
+  else
+    {
+      pp_string (buffer, "#pragma omp single");
+      dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags);
+      if (!gimple_seq_empty_p (gimple_omp_body (gs)))
+	{
+	  newline_and_indent (buffer, spc + 2);
+	  pp_character (buffer, '{');
+	  newline_and_indent (buffer, spc + 4);
+	  dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
+	  newline_and_indent (buffer, spc + 2);
+	  pp_character (buffer, '}');
+	}
+    }
+}
+
 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER.  */
 
 static void
@@ -1249,6 +1277,10 @@ dump_gimple_stmt (pretty_printer *buffer
       dump_gimple_omp_continue (buffer, gs, spc, flags);
       break;
 
+    case GIMPLE_OMP_SINGLE:
+      dump_gimple_omp_single (buffer, gs, spc, flags);
+      break;
+
     case GIMPLE_OMP_RETURN:
       dump_gimple_omp_return (buffer, gs, spc, flags);
       break;
Index: gimplify.c
===================================================================
--- gimplify.c	(revision 135313)
+++ gimplify.c	(working copy)
@@ -5685,12 +5685,7 @@ gimplify_omp_workshare (tree *expr_p, gi
   else
     gcc_unreachable ();
 
-  /* FIXME tuples: Adding the GIMPLE_OMP_{SECTIONS,SINGLE} construct
-     to the sequence causes all sorts of problems because we have
-     disabled omp lowering is still disabled.  Disable this for now
-     until we enable omp_low() and friends.
   gimplify_seq_add_stmt (pre_p, stmt);
-  */
 }
 
 /* A subroutine of gimplify_omp_atomic.  The front end is supposed to have
Index: gimple.c
===================================================================
--- gimple.c	(revision 135313)
+++ gimple.c	(working copy)
@@ -104,7 +104,8 @@ gss_for_code (enum gimple_code code)
     case GIMPLE_OMP_MASTER:		
     case GIMPLE_OMP_ORDERED:
     case GIMPLE_OMP_SECTION:		return GSS_OMP;
-    case GIMPLE_OMP_RETURN:		return GSS_BASE;
+    case GIMPLE_OMP_RETURN:
+    case GIMPLE_OMP_SECTIONS_SWITCH:    return GSS_BASE;
     case GIMPLE_OMP_CONTINUE:		return GSS_OMP_CONTINUE;
     case GIMPLE_OMP_PARALLEL:		return GSS_OMP_PARALLEL;
     case GIMPLE_OMP_SECTIONS:		return GSS_OMP_SECTIONS;
@@ -2312,7 +2313,12 @@ gimple_regimplify_operands (gimple stmt,
 	 and ASMs are executed before the LHS.  The ordering is not
 	 important for other statements.  */
       tree op = gimple_op (stmt, num_ops - i - 1);
-      if (!is_gimple_operand (op))
+
+      /* We probably don't want to touch inline asm operands.  */
+      if (gimple_code (stmt) == GIMPLE_ASM)
+	continue;
+
+      if (op && !is_gimple_operand (op))
 	{
 	  op = force_gimple_operand_gsi (gsi_p, op, true, NULL, true,
 					 GSI_SAME_STMT);
Index: gimple.h
===================================================================
--- gimple.h	(revision 135313)
+++ gimple.h	(working copy)
@@ -3258,8 +3258,8 @@ is_gimple_omp (const_gimple stmt)
 	  || gimple_code (stmt) == GIMPLE_OMP_ORDERED
 	  || gimple_code (stmt) == GIMPLE_OMP_CRITICAL
 	  || gimple_code (stmt) == GIMPLE_OMP_RETURN
-	  || gimple_code (stmt) == OMP_ATOMIC_LOAD
-	  || gimple_code (stmt) == OMP_ATOMIC_STORE
+	  || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD
+	  || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE
 	  || gimple_code (stmt) == GIMPLE_OMP_CONTINUE);
 }
 
Index: tree-cfg.c
===================================================================
--- tree-cfg.c	(revision 135322)
+++ tree-cfg.c	(working copy)
@@ -576,7 +576,7 @@ make_edges (void)
 		    struct omp_region *i;
 		    for (i = cur_region->inner; i ; i = i->next)
 		      {
-			gcc_assert (i->type == OMP_SECTION);
+			gcc_assert (i->type == GIMPLE_OMP_SECTION);
 			make_edge (switch_bb, i->entry, 0);
 			make_edge (i->exit, bb, EDGE_FALLTHRU);
 		      }


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