Index: gimple-fold.c
===================================================================
--- gimple-fold.c       (revision 161602)
+++ gimple-fold.c       (working copy)
@@ -1150,7 +1150,14 @@ 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);
+         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 +1165,13 @@ 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));
+         SSA_NAME_DEF_STMT (gimple_vdef (stmt)) = new_stmt;
+       }
     }

   gimple_set_location (new_stmt, gimple_location (stmt));
