Patchwork [rfa] Fix PR44699: bootstrap problem

login
register
mail settings
Submitter Michael Matz
Date June 30, 2010, 4:41 p.m.
Message ID <Pine.LNX.4.64.1006301835140.18619@wotan.suse.de>
Download mbox | patch
Permalink /patch/57439/
State New
Headers show

Comments

Michael Matz - June 30, 2010, 4:41 p.m.
Hi,

On Wed, 30 Jun 2010, Dominique Dhumieres wrote:

> With the patches in
> 
> http://gcc.gnu.org/ml/gcc-patches/2010-06/msg03011.html
> http://gcc.gnu.org/ml/gcc-patches/2010-06/msg03122.html
> 
> plus my fix for pr44726, I am now finishing to bootstrap
> trunk at revision 161606 (currently building libjava).

Okay, super.  If you run the testsuite you'll probably notice a FAIL 
relating to "expecting ssa_name but got var_decl" or similar.  I've fixed 
that in the checked in version (r161614 btw).

FWIW, I've had to guard the assignment to SSA_NAME_DEF_STMT with a check 
for gimple_vdef(stmt) being an SSA_NAME, as we might get called on 
statements that aren't fully updated already.  The final gimple-fold.c 
change I've checked in is below (the rest was as posted already).

I'm going to cleanup that function somewhat later, as promised.


Ciao,
Michael.
--

Patch

Index: gimple-fold.c
===================================================================
--- gimple-fold.c	(revision 161613)
+++ gimple-fold.c	(revision 161614)
@@ -1133,7 +1133,8 @@  gimplify_and_update_call_from_tree (gimp
       if (gimple_vdef (stmt) && laststore)
 	{
 	  gimple_set_vdef (laststore, gimple_vdef (stmt));
-	  move_ssa_defining_stmt_for_defs (laststore, stmt);
+	  if (TREE_CODE (gimple_vdef (stmt)) == SSA_NAME)
+	    SSA_NAME_DEF_STMT (gimple_vdef (stmt)) = laststore;
 	  update_stmt (laststore);
 	}
       else
@@ -1150,7 +1151,15 @@  gimplify_and_update_call_from_tree (gimp
 	  gsi_insert_before (si_p, last, GSI_NEW_STMT);
 	  gsi_next (si_p);
 	}
-      if (laststore)
+      if (laststore && is_gimple_reg (lhs))
+	{
+	  gimple_set_vdef (laststore, gimple_vdef (stmt));
+	  update_stmt (laststore);
+	  if (TREE_CODE (gimple_vdef (stmt)) == SSA_NAME)
+	    SSA_NAME_DEF_STMT (gimple_vdef (stmt)) = laststore;
+	  laststore = NULL;
+	}
+      else if (laststore)
 	{
 	  reaching_vuse = make_ssa_name (gimple_vop (cfun), laststore);
 	  gimple_set_vdef (laststore, reaching_vuse);
@@ -1158,9 +1167,14 @@  gimplify_and_update_call_from_tree (gimp
 	  laststore = NULL;
 	}
       new_stmt = gimple_build_assign (lhs, tmp);
-      gimple_set_vuse (new_stmt, reaching_vuse);
-      gimple_set_vdef (new_stmt, gimple_vdef (stmt));
-      move_ssa_defining_stmt_for_defs (new_stmt, stmt);
+      if (!is_gimple_reg (tmp))
+	gimple_set_vuse (new_stmt, reaching_vuse);
+      if (!is_gimple_reg (lhs))
+	{
+	  gimple_set_vdef (new_stmt, gimple_vdef (stmt));
+	  if (TREE_CODE (gimple_vdef (stmt)) == SSA_NAME)
+	    SSA_NAME_DEF_STMT (gimple_vdef (stmt)) = new_stmt;
+	}
     }
 
   gimple_set_location (new_stmt, gimple_location (stmt));