Patchwork [3/n] Remove mark_symbols_for_renaming

login
register
mail settings
Submitter Richard Guenther
Date May 14, 2012, 1:50 p.m.
Message ID <Pine.LNX.4.64.1205141548130.11924@jbgna.fhfr.qr>
Download mbox | patch
Permalink /patch/159004/
State New
Headers show

Comments

Richard Guenther - May 14, 2012, 1:50 p.m.
This makes sure we consistently (in all paths into the gimplifier)
mark generated _LHS_(!) for renaming.  This exposes enough bugs in
OMP lowering in SSA form (via autopar) that this is 3/n and not 2/n
which relies on random stmt operands being rewritten into SSA form
for random stmt gimplification ...

Bootstrapped and tested on x86_64-unknown-linux-gnu (with autopar
fallout hopefully fixed by 2/n).

Richard.

2012-05-14  Richard Guenther  <rguenther@suse.de>

	* gimplify.c (gimple_regimplify_operands): Only mark the LHS
	of statements for renaming.
	(force_gimple_operand_1): Likewise, consistently for both
	calls to force_gimple_operand and force_gimple_operand_gsi.

Patch

Index: gcc/gimplify.c
===================================================================
--- gcc/gimplify.c	(revision 187456)
+++ gcc/gimplify.c	(working copy)
@@ -8531,7 +8531,13 @@  gimple_regimplify_operands (gimple stmt,
 	  gimple_stmt_iterator i;
 
 	  for (i = gsi_start (pre); !gsi_end_p (i); gsi_next (&i))
-	    mark_symbols_for_renaming (gsi_stmt (i));
+	    {
+	      tree lhs = gimple_get_lhs (gsi_stmt (i));
+	      if (lhs
+		  && TREE_CODE (lhs) != SSA_NAME
+		  && is_gimple_reg (lhs))
+		mark_sym_for_renaming (lhs);
+	    }
 	}
       gsi_insert_seq_before (gsi_p, pre, GSI_SAME_STMT);
     }
@@ -8585,6 +8591,21 @@  force_gimple_operand_1 (tree expr, gimpl
     for (t = gimplify_ctxp->temps; t ; t = DECL_CHAIN (t))
       add_referenced_var (t);
 
+  if (!gimple_seq_empty_p (*stmts)
+      && gimplify_ctxp->into_ssa)
+    {
+      gimple_stmt_iterator i;
+
+      for (i = gsi_start (*stmts); !gsi_end_p (i); gsi_next (&i))
+	{
+	  tree lhs = gimple_get_lhs (gsi_stmt (i));
+	  if (lhs
+	      && TREE_CODE (lhs) != SSA_NAME
+	      && is_gimple_reg (lhs))
+	    mark_sym_for_renaming (lhs);
+	}
+    }
+
   pop_gimplify_context (NULL);
 
   return expr;
@@ -8621,14 +8642,6 @@  force_gimple_operand_gsi_1 (gimple_stmt_
 
   if (!gimple_seq_empty_p (stmts))
     {
-      if (gimple_in_ssa_p (cfun))
-	{
-	  gimple_stmt_iterator i;
-
-	  for (i = gsi_start (stmts); !gsi_end_p (i); gsi_next (&i))
-	    mark_symbols_for_renaming (gsi_stmt (i));
-	}
-
       if (before)
 	gsi_insert_seq_before (gsi, stmts, m);
       else