]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/omp-simd-clone.c
c++: Handle multiple aggregate overloads [PR95319].
[thirdparty/gcc.git] / gcc / omp-simd-clone.c
index 71ff03412044406a9e3f804c64cc782a1d7d590a..942fb971cb786e47ad444662d9654d3580b4c468 100644 (file)
@@ -477,6 +477,7 @@ simd_clone_create (struct cgraph_node *old_node)
      the old node.  */
   new_node->local = old_node->local;
   new_node->externally_visible = old_node->externally_visible;
+  new_node->calls_declare_variant_alt = old_node->calls_declare_variant_alt;
 
   return new_node;
 }
@@ -821,6 +822,7 @@ simd_clone_init_simd_arrays (struct cgraph_node *node,
 struct modify_stmt_info {
   ipa_param_body_adjustments *adjustments;
   gimple *stmt;
+  gimple *after_stmt;
   /* True if the parent statement was modified by
      ipa_simd_modify_stmt_ops.  */
   bool modified;
@@ -912,7 +914,10 @@ ipa_simd_modify_stmt_ops (tree *tp, int *walk_subtrees, void *data)
       gimple_stmt_iterator gsi;
       if (gimple_code (info->stmt) == GIMPLE_PHI)
        {
-         gsi = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)));
+         if (info->after_stmt)
+           gsi = gsi_for_stmt (info->after_stmt);
+         else
+           gsi = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)));
          /* Cache SSA_NAME for next time.  */
          if (pbr
              && TREE_CODE (*orig_tp) == ADDR_EXPR
@@ -924,7 +929,12 @@ ipa_simd_modify_stmt_ops (tree *tp, int *walk_subtrees, void *data)
        }
       else
        gsi = gsi_for_stmt (info->stmt);
-      gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+      if (info->after_stmt)
+       gsi_insert_after (&gsi, stmt, GSI_SAME_STMT);
+      else
+       gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+      if (gimple_code (info->stmt) == GIMPLE_PHI)
+       info->after_stmt = stmt;
       *orig_tp = repl;
     }
   else if (!useless_type_conversion_p (TREE_TYPE (*tp), TREE_TYPE (repl)))
@@ -1015,6 +1025,7 @@ ipa_simd_modify_function_body (struct cgraph_node *node,
          gphi *phi = as_a <gphi *> (gsi_stmt (gsi));
          int i, n = gimple_phi_num_args (phi);
          info.stmt = phi;
+         info.after_stmt = NULL;
          struct walk_stmt_info wi;
          memset (&wi, 0, sizeof (wi));
          info.modified = false;
@@ -1040,6 +1051,7 @@ ipa_simd_modify_function_body (struct cgraph_node *node,
        {
          gimple *stmt = gsi_stmt (gsi);
          info.stmt = stmt;
+         info.after_stmt = NULL;
          struct walk_stmt_info wi;
 
          memset (&wi, 0, sizeof (wi));