re PR middle-end/35411 (internal compiler error: in set_ssa_val_to, at tree-ssa-sccvn...
authorRichard Guenther <rguenther@suse.de>
Sat, 1 Mar 2008 00:27:26 +0000 (00:27 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sat, 1 Mar 2008 00:27:26 +0000 (00:27 +0000)
2008-03-01  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/35411
* tree-sra.c (sra_build_assignment): Split conversion to
final type to a separate statement if we are not assigning
to a register.

From-SVN: r132791

gcc/ChangeLog
gcc/tree-sra.c

index e6f51daf6126ace7d272f972394c65e5eea80aff..2944d20b64d7436808b207ef1bb0c37584a94096 100644 (file)
@@ -1,3 +1,10 @@
+2008-03-01  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/35411
+       * tree-sra.c (sra_build_assignment): Split conversion to
+       final type to a separate statement if we are not assigning
+       to a register.
+
 2008-02-29  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
 
        * fold-const.c (fold_convertible_p): Correct the logic to follow
index 26f1af4196a00729f0f72addb7b04bb667ef91c8..1f2d6c25e62b2061cda20bcdc6bbd2e1b105a399 100644 (file)
@@ -2139,7 +2139,7 @@ sra_build_assignment (tree dst, tree src)
   if (scalar_bitfield_p (src))
     {
       tree var, shift, width;
-      tree utype, stype, stmp, utmp;
+      tree utype, stype, stmp, utmp, dtmp;
       tree list, stmt;
       bool unsignedp = BIT_FIELD_REF_UNSIGNED (src);
 
@@ -2256,6 +2256,16 @@ sra_build_assignment (tree dst, tree src)
            var = fold_convert (TREE_TYPE (dst), var);
          else
            var = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (dst), var);
+
+         /* If the destination is not a register the conversion needs
+            to be a separate statement.  */
+         if (!is_gimple_reg (dst))
+           {
+             dtmp = make_rename_temp (TREE_TYPE (dst), "SR");
+             stmt = build_gimple_modify_stmt (dtmp, var);
+             append_to_statement_list (stmt, &list);
+             var = dtmp;
+           }
        }
       stmt = build_gimple_modify_stmt (dst, var);
       append_to_statement_list (stmt, &list);