]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR middle-end/55921 (Crash in verify_ssa for asm to side-steps complex...
authorJakub Jelinek <jakub@redhat.com>
Wed, 3 Apr 2013 18:00:52 +0000 (20:00 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 3 Apr 2013 18:00:52 +0000 (20:00 +0200)
Backported from mainline
2013-01-10  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/55921
* tree-complex.c (expand_complex_asm): New function.
(expand_complex_operations_1): Call it for GIMPLE_ASM.

From-SVN: r197446

gcc/ChangeLog
gcc/tree-complex.c

index 4c49df5801bdd22c3dd7d644c0a9995e32a599a5..5cc55c15b1c3c5645444218d08974233e47bf371 100644 (file)
@@ -1,6 +1,12 @@
 2013-04-03  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2013-01-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/55921
+       * tree-complex.c (expand_complex_asm): New function.
+       (expand_complex_operations_1): Call it for GIMPLE_ASM.
+
        2012-09-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/54486
index ec2b438ca47c59d29b7a7e97c00b8e95c26412f9..58ac7633a1a0640e20c1d54f20fef79ddb2f1b7a 100644 (file)
@@ -1400,6 +1400,36 @@ expand_complex_comparison (gimple_stmt_iterator *gsi, tree ar, tree ai,
   update_stmt (stmt);
 }
 
+/* Expand inline asm that sets some complex SSA_NAMEs.  */
+
+static void
+expand_complex_asm (gimple_stmt_iterator *gsi)
+{
+  gimple stmt = gsi_stmt (*gsi);
+  unsigned int i;
+
+  for (i = 0; i < gimple_asm_noutputs (stmt); ++i)
+    {
+      tree link = gimple_asm_output_op (stmt, i);
+      tree op = TREE_VALUE (link);
+      if (TREE_CODE (op) == SSA_NAME
+         && TREE_CODE (TREE_TYPE (op)) == COMPLEX_TYPE)
+       {
+         tree type = TREE_TYPE (op);
+         tree inner_type = TREE_TYPE (type);
+         tree r = build1 (REALPART_EXPR, inner_type, op);
+         tree i = build1 (IMAGPART_EXPR, inner_type, op);
+         gimple_seq list = set_component_ssa_name (op, false, r);
+
+         if (list)
+           gsi_insert_seq_after (gsi, list, GSI_CONTINUE_LINKING);
+
+         list = set_component_ssa_name (op, true, i);
+         if (list)
+           gsi_insert_seq_after (gsi, list, GSI_CONTINUE_LINKING);
+       }
+    }
+}
 
 /* Process one statement.  If we identify a complex operation, expand it.  */
 
@@ -1412,6 +1442,12 @@ expand_complex_operations_1 (gimple_stmt_iterator *gsi)
   complex_lattice_t al, bl;
   enum tree_code code;
 
+  if (gimple_code (stmt) == GIMPLE_ASM)
+    {
+      expand_complex_asm (gsi);
+      return;
+    }
+
   lhs = gimple_get_lhs (stmt);
   if (!lhs && gimple_code (stmt) != GIMPLE_COND)
     return;