On 11/07/13 09:09, Martin Jambor wrote:

I am glad this is becoming a useful infrastructure rather than just a
part of IPA-SRA.  Note that while ipa_combine_adjustments is not used
from anywhere and thus probably buggy anyway, it should in theory be
able to process new_param adjustments too.  Can you please at least
put a "not implemented" assert there?  (The reason is that the plan

Done.

diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index c38ba82..faae080 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -446,6 +446,13 @@ determine_versionability (struct cgraph_node *node)
      reason = "not a tree_versionable_function";
    else if (cgraph_function_body_availability (node) <= AVAIL_OVERWRITABLE)
      reason = "insufficient body availability";
+  else if (node->has_simd_clones)
+    {
+      /* Ideally we should clone the SIMD clones themselves and create
+        vector copies of them, so IPA-cp and SIMD clones can happily
+        coexist, but that may not be worth the effort.  */
+      reason = "function has SIMD clones";
+    }

Lets hope we will eventually fix this in some followup :-)

Sure, but to be honest it's not super high on my priority list, perhaps once the basic functionality is in trunk.

+  tree new_arg_types = NULL;
+  for (int i = 0; i < len; i++)
      {
        struct ipa_parm_adjustment *adj;
        gcc_assert (link);

        adj = &adjustments[i];
-      parm = oparms[adj->base_index];
+      tree parm;
+      if (adj->new_param)

I don't know what I was thinking when I invented copy_param and
remove_param as multiple flags rather than a single enum, I probably
wasn't thinking at all.  I can change it myself as a followup if you
have more pressing tasks now.  Meanwhile, can you gcc_checking_assert
that at most one flag is set at appropriate places?

Not a problem, I can implement the enum changes since I'm already changing all this code. Done.


+       parm = NULL;
+      else
+       parm = oparms[adj->base_index];
        adj->base = parm;

I do not think it makes sense for new parameters to have a base which
is basically the old decl.  Do you have any reasons for not setting it
to NULL?

In this particular case, adj->base is already being set to NULL because parm=NULL for adj->op. The code now reads:


      if (adj->op == IPA_PARM_OP_NEW)
        parm = NULL;
      else
        parm = oparms[adj->base_index];
      adj->base = parm;

Am I missing something? Base is already been set to NULL for new parameters.



        if (adj->copy_param)
@@ -3417,8 +3418,18 @@ ipa_modify_formal_parameters (tree fndecl, 
ipa_parm_adjustment_vec adjustments,
          tree new_parm;
          tree ptype;


-         if (adj->by_ref)
-           ptype = build_pointer_type (adj->type);

Please add gcc_checking_assert (!adj->by_ref || adj->simdlen == 0)
here...

Done.

+         const char *prefix
+           = adj->new_param ? adj->new_arg_prefix : synth_parm_prefix;

Can we perhaps get rid of synth_parm_prefix then and just have
adj->new_arg_prefix?  It's not particularly important but this is
weird.

Done.



+         DECL_NAME (new_parm) = create_tmp_var_name (prefix);
          DECL_ARTIFICIAL (new_parm) = 1;
          DECL_ARG_TYPE (new_parm) = ptype;
          DECL_CONTEXT (new_parm) = fndecl;
@@ -3436,17 +3448,20 @@ ipa_modify_formal_parameters (tree fndecl, 
ipa_parm_adjustment_vec adjustments,
          DECL_IGNORED_P (new_parm) = 1;
          layout_decl (new_parm, 0);

-         adj->base = parm;
+         if (adj->new_param)
+           adj->base = new_parm;

Again, shouldn't this be NULL?

This one, yes :).  Done.

diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index 48634d2..8d7d9b9 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -634,9 +634,10 @@ struct ipa_parm_adjustment
       arguments.  */
    tree alias_ptr_type;

-  /* The new declaration when creating/replacing a parameter.  Created by
-     ipa_modify_formal_parameters, useful for functions modifying the body
-     accordingly. */
+  /* The new declaration when creating/replacing a parameter.  Created
+     by ipa_modify_formal_parameters, useful for functions modifying
+     the body accordingly.  For brand new arguments, this is the newly
+     created argument.  */
    tree reduction;

We should eventually rename this to new_decl or something, given that
this is not an SRA thing any more.  But that can be done later.

Done.



    /* New declaration of a substitute variable that we may use to replace all
@@ -647,15 +648,36 @@ struct ipa_parm_adjustment
       is NULL), this is going to be its nonlocalized vars value.  */
    tree nonlocal_value;

+  /* If this is a brand new argument, this holds the prefix to be used
+     for the DECL_NAME.  */
+  const char *new_arg_prefix;
+
    /* Offset into the original parameter (for the cases when the new parameter
       is a component of an original one).  */
    HOST_WIDE_INT offset;

-  /* Zero based index of the original parameter this one is based on.  (ATM
-     there is no way to insert a new parameter out of the blue because there is
-     no need but if it arises the code can be easily exteded to do so.)  */
+  /* Zero based index of the original parameter this one is based on.  */
    int base_index;

+  /* If non-null, the parameter is a vector of `type' with this many
+     elements.  */
+  int simdlen;
+
+  /* This is a brand new parameter.
+
+     For new parameters, base_index must be >= the number of
+     DECL_ARGUMENTS in the function.  That is, new arguments will be
+     the last arguments in the adjusted function.
+
+     ?? Perhaps we could redesign ipa_modify_formal_parameters() to
+     reorganize argument position, thus allowing inserting of brand
+     new arguments anywhere, but there is no use for this now.

Where does this requirement come from?  At least at the moment I
cannot see why ipa_modify_formal_parameters wouldn't be able to
reorder parameters as it is?  What breaks if base_index of adjustments
for new parameters has zero or a nonsensical value?

From my very vivid imagination. Forget I said that. I hadn't looked into it at all; I just assumed. I have removed the ??? comment.

Hm, if you can directly use these, I really think you should rename
them somehow so that their names do not contain SRA and move them to
ipa-prop.c.

I'd like to do this as a followup so you can see all my changes before I move things en masse.


Thanks for reviving this slightly moribund infrastructure and sorry
again for the delay,

Not a problem.  Thanks for the review.

Would you be so kind as to review these changes to make sure I didn't miss anything?

The patch is lightly tested as my current box is pathetically slow today but so far so good with gomp.exp tests.

OK for gomp-4_0-branch pending tests?

Aldy

commit c4daa339084cb2d67b49fa2c33245ea09057752e
Author: Aldy Hernandez <al...@redhat.com>
Date:   Fri Nov 8 09:29:49 2013 -0700

        * ipa-prop.c (ipa_modify_formal_parameters): Remove
        synth_parm_prefix argument.
        Use operator enum instead of bit fields.
        Add assert for properly handling vector of references.
        (ipa_modify_call_arguments): Use operator enum instead of bit
        fields.
        (ipa_combine_adjustments): Same.
        Assert that IPA_PARM_OP_NEW is not used.
        (ipa_dump_param_adjustments): Rename reduction to new_decl.
        Use operator enum instead of bit fields.
        * ipa-prop.h (enum ipa_parm_op): New.
        (struct ipa_parm_adjustment): New field op.
        Rename reduction to new_decl.
        Rename new_arg_prefix to arg_prefix.
        Remove new_param, remove_param, copy_param.
        (ipa_modify_formal_parameters): Remove argument.
        * omp-low.c (simd_clone_adjust_argument_types): Set arg_prefix.
        Use operator enum instead of bit fields.
        (simd_clone_adjust_argument_types): Use operator enum instead of
        bit fields.
        Remove last argument to ipa_modify_formal_parameters call.
        (simd_clone_init_simd_arrays): Use operator enum.
        (ipa_simd_modify_stmt_ops): Rename reduction to new_decl.
        (ipa_simd_modify_function_body): Same.
        * tree-sra.c (turn_representatives_into_adjustments): Use operator
        enum.  Set arg_prefix.
        (get_adjustment_for_base): Use operator enum.
        (sra_ipa_get_adjustment_candidate): Same.
        (sra_ipa_modify_expr): Rename reduction to new_decl.
        (sra_ipa_reset_debug_stmts): Use operator enum.
        (modify_function): Do not pass prefix argument.

diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 94a47cb..2a1f1e8 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -3362,12 +3362,8 @@ get_vector_of_formal_parm_types (tree fntype)
    base_index field.  */
 
 void
-ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments,
-                             const char *synth_parm_prefix)
+ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments)
 {
-  if (!synth_parm_prefix)
-    synth_parm_prefix = "SYNTH";
-
   vec<tree> oparms = ipa_get_vector_of_formal_parms (fndecl);
   tree orig_type = TREE_TYPE (fndecl);
   tree old_arg_types = TYPE_ARG_TYPES (orig_type);
@@ -3403,13 +3399,13 @@ ipa_modify_formal_parameters (tree fndecl, 
ipa_parm_adjustment_vec adjustments,
 
       adj = &adjustments[i];
       tree parm;
-      if (adj->new_param)
+      if (adj->op == IPA_PARM_OP_NEW)
        parm = NULL;
       else
        parm = oparms[adj->base_index];
       adj->base = parm;
 
-      if (adj->copy_param)
+      if (adj->op == IPA_PARM_OP_COPY)
        {
          if (care_for_types)
            new_arg_types = tree_cons (NULL_TREE, otypes[adj->base_index],
@@ -3417,11 +3413,12 @@ ipa_modify_formal_parameters (tree fndecl, 
ipa_parm_adjustment_vec adjustments,
          *link = parm;
          link = &DECL_CHAIN (parm);
        }
-      else if (!adj->remove_param)
+      else if (adj->op != IPA_PARM_OP_REMOVE)
        {
          tree new_parm;
          tree ptype;
 
+         gcc_checking_assert (!adj->by_ref || adj->simdlen);
          if (adj->simdlen)
            {
              /* If we have a non-null simdlen but by_ref is true, we
@@ -3442,8 +3439,7 @@ ipa_modify_formal_parameters (tree fndecl, 
ipa_parm_adjustment_vec adjustments,
 
          new_parm = build_decl (UNKNOWN_LOCATION, PARM_DECL, NULL_TREE,
                                 ptype);
-         const char *prefix
-           = adj->new_param ? adj->new_arg_prefix : synth_parm_prefix;
+         const char *prefix = adj->arg_prefix ? adj->arg_prefix : "SYNTH";
          DECL_NAME (new_parm) = create_tmp_var_name (prefix);
          DECL_ARTIFICIAL (new_parm) = 1;
          DECL_ARG_TYPE (new_parm) = ptype;
@@ -3452,11 +3448,11 @@ ipa_modify_formal_parameters (tree fndecl, 
ipa_parm_adjustment_vec adjustments,
          DECL_IGNORED_P (new_parm) = 1;
          layout_decl (new_parm, 0);
 
-         if (adj->new_param)
-           adj->base = new_parm;
+         if (adj->op == IPA_PARM_OP_NEW)
+           adj->base = NULL;
          else
            adj->base = parm;
-         adj->reduction = new_parm;
+         adj->new_decl = new_parm;
 
          *link = new_parm;
          link = &DECL_CHAIN (new_parm);
@@ -3485,7 +3481,7 @@ ipa_modify_formal_parameters (tree fndecl, 
ipa_parm_adjustment_vec adjustments,
      instead.  */
   tree new_type = NULL;
   if (TREE_CODE (orig_type) != METHOD_TYPE
-       || (adjustments[0].copy_param
+       || (adjustments[0].op == IPA_PARM_OP_COPY
          && adjustments[0].base_index == 0))
     {
       new_type = build_distinct_type_copy (orig_type);
@@ -3558,13 +3554,13 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, 
gimple stmt,
 
       adj = &adjustments[i];
 
-      if (adj->copy_param)
+      if (adj->op == IPA_PARM_OP_COPY)
        {
          tree arg = gimple_call_arg (stmt, adj->base_index);
 
          vargs.quick_push (arg);
        }
-      else if (!adj->remove_param)
+      else if (adj->op != IPA_PARM_OP_REMOVE)
        {
          tree expr, base, off;
          location_t loc;
@@ -3683,7 +3679,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple 
stmt,
                                           NULL, true, GSI_SAME_STMT);
          vargs.quick_push (expr);
        }
-      if (!adj->copy_param && MAY_HAVE_DEBUG_STMTS)
+      if (adj->op != IPA_PARM_OP_COPY && MAY_HAVE_DEBUG_STMTS)
        {
          unsigned int ix;
          tree ddecl = NULL_TREE, origin = DECL_ORIGIN (adj->base), arg;
@@ -3803,10 +3799,14 @@ ipa_combine_adjustments (ipa_parm_adjustment_vec inner,
       struct ipa_parm_adjustment *n;
       n = &inner[i];
 
-      if (n->remove_param)
+      if (n->op == IPA_PARM_OP_REMOVE)
        removals++;
       else
-       tmp.quick_push (*n);
+       {
+         /* FIXME: Handling of new arguments are not implemented yet.  */
+         gcc_assert (n->op != IPA_PARM_OP_NEW);
+         tmp.quick_push (*n);
+       }
     }
 
   adjustments.create (outlen + removals);
@@ -3817,27 +3817,32 @@ ipa_combine_adjustments (ipa_parm_adjustment_vec inner,
       struct ipa_parm_adjustment *in = &tmp[out->base_index];
 
       memset (&r, 0, sizeof (r));
-      gcc_assert (!in->remove_param);
-      if (out->remove_param)
+      gcc_assert (in->op != IPA_PARM_OP_REMOVE);
+      if (out->op == IPA_PARM_OP_REMOVE)
        {
          if (!index_in_adjustments_multiple_times_p (in->base_index, tmp))
            {
-             r.remove_param = true;
+             r.op = IPA_PARM_OP_REMOVE;
              adjustments.quick_push (r);
            }
          continue;
        }
+      else
+       {
+         /* FIXME: Handling of new arguments are not implemented yet.  */
+         gcc_assert (out->op != IPA_PARM_OP_NEW);
+       }
 
       r.base_index = in->base_index;
       r.type = out->type;
 
       /* FIXME:  Create nonlocal value too.  */
 
-      if (in->copy_param && out->copy_param)
-       r.copy_param = true;
-      else if (in->copy_param)
+      if (in->op == IPA_PARM_OP_COPY && out->op == IPA_PARM_OP_COPY)
+       r.op = IPA_PARM_OP_COPY;
+      else if (in->op == IPA_PARM_OP_COPY)
        r.offset = out->offset;
-      else if (out->copy_param)
+      else if (out->op == IPA_PARM_OP_COPY)
        r.offset = in->offset;
       else
        r.offset = in->offset + out->offset;
@@ -3848,7 +3853,7 @@ ipa_combine_adjustments (ipa_parm_adjustment_vec inner,
     {
       struct ipa_parm_adjustment *n = &inner[i];
 
-      if (n->remove_param)
+      if (n->op == IPA_PARM_OP_REMOVE)
        adjustments.quick_push (*n);
     }
 
@@ -3885,10 +3890,10 @@ ipa_dump_param_adjustments (FILE *file, 
ipa_parm_adjustment_vec adjustments,
          fprintf (file, ", base: ");
          print_generic_expr (file, adj->base, 0);
        }
-      if (adj->reduction)
+      if (adj->new_decl)
        {
-         fprintf (file, ", reduction: ");
-         print_generic_expr (file, adj->reduction, 0);
+         fprintf (file, ", new_decl: ");
+         print_generic_expr (file, adj->new_decl, 0);
        }
       if (adj->new_ssa_base)
        {
@@ -3896,9 +3901,9 @@ ipa_dump_param_adjustments (FILE *file, 
ipa_parm_adjustment_vec adjustments,
          print_generic_expr (file, adj->new_ssa_base, 0);
        }
 
-      if (adj->copy_param)
+      if (adj->op == IPA_PARM_OP_COPY)
        fprintf (file, ", copy_param");
-      else if (adj->remove_param)
+      else if (adj->op == IPA_PARM_OP_REMOVE)
        fprintf (file, ", remove_param");
       else
        fprintf (file, ", offset %li", (long) adj->offset);
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index 6aebf8d..e1e8622 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -609,6 +609,31 @@ extern alloc_pool ipcp_values_pool;
 extern alloc_pool ipcp_sources_pool;
 extern alloc_pool ipcp_agg_lattice_pool;
 
+/* Operation to be performed for the parameter in ipa_parm_adjustment
+   below.  */
+enum ipa_parm_op {
+  IPA_PARM_OP_NONE,
+
+  /* This describes a brand new parameter.
+
+     For new parameters, base_index must be >= the number of
+     DECL_ARGUMENTS in the function.  That is, new arguments will be
+     the last arguments in the adjusted function.
+
+     Also, `type' should be set to the new type, `arg_prefix'
+     should be set to the string prefix for the new DECL_NAME, and
+     `new_decl' will ultimately hold the newly created argument.  */
+  IPA_PARM_OP_NEW,
+
+  /* This new parameter is an unmodified parameter at index base_index. */
+  IPA_PARM_OP_COPY,
+
+  /* This adjustment describes a parameter that is about to be removed
+     completely.  Most users will probably need to book keep those so that they
+     don't leave behinfd any non default def ssa names belonging to them.  */
+  IPA_PARM_OP_REMOVE
+};
+
 /* Structure to describe transformations of formal parameters and actual
    arguments.  Each instance describes one new parameter and they are meant to
    be stored in a vector.  Additionally, most users will probably want to store
@@ -636,7 +661,7 @@ struct ipa_parm_adjustment
      by ipa_modify_formal_parameters, useful for functions modifying
      the body accordingly.  For brand new arguments, this is the newly
      created argument.  */
-  tree reduction;
+  tree new_decl;
 
   /* New declaration of a substitute variable that we may use to replace all
      non-default-def ssa names when a parm decl is going away.  */
@@ -646,9 +671,8 @@ struct ipa_parm_adjustment
      is NULL), this is going to be its nonlocalized vars value.  */
   tree nonlocal_value;
 
-  /* If this is a brand new argument, this holds the prefix to be used
-     for the DECL_NAME.  */
-  const char *new_arg_prefix;
+  /* This holds the prefix to be used for the new DECL_NAME.  */
+  const char *arg_prefix;
 
   /* Offset into the original parameter (for the cases when the new parameter
      is a component of an original one).  */
@@ -661,28 +685,9 @@ struct ipa_parm_adjustment
      elements.  */
   int simdlen;
 
-  /* This is a brand new parameter.
-
-     For new parameters, base_index must be >= the number of
-     DECL_ARGUMENTS in the function.  That is, new arguments will be
-     the last arguments in the adjusted function.
-
-     ?? Perhaps we could redesign ipa_modify_formal_parameters() to
-     reorganize argument position, thus allowing inserting of brand
-     new arguments anywhere, but there is no use for this now.
-
-     Also, `type' should be set to the new type, `new_arg_prefix'
-     should be set to the string prefix for the new DECL_NAME, and
-     `reduction' will ultimately hold the newly created argument.  */
-  unsigned new_param : 1;
-
-  /* This new parameter is an unmodified parameter at index base_index. */
-  unsigned copy_param : 1;
-
-  /* This adjustment describes a parameter that is about to be removed
-     completely.  Most users will probably need to book keep those so that they
-     don't leave behinfd any non default def ssa names belonging to them.  */
-  unsigned remove_param : 1;
+  /* Whether this parameter is a new parameter, a copy of an old one,
+     or one about to be removed.  */
+  enum ipa_parm_op op;
 
   /* The parameter is to be passed by reference.  */
   unsigned by_ref : 1;
@@ -693,8 +698,7 @@ typedef struct ipa_parm_adjustment ipa_parm_adjustment_t;
 typedef vec<ipa_parm_adjustment_t> ipa_parm_adjustment_vec;
 
 vec<tree> ipa_get_vector_of_formal_parms (tree fndecl);
-void ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec,
-                                  const char *);
+void ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec);
 void ipa_modify_call_arguments (struct cgraph_edge *, gimple,
                                ipa_parm_adjustment_vec);
 ipa_parm_adjustment_vec ipa_combine_adjustments (ipa_parm_adjustment_vec,
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 6845ee6..51cda58 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -11635,7 +11635,7 @@ simd_clone_adjust_argument_types (struct cgraph_node 
*node)
       if (node->simdclone->args[i].arg_type != SIMD_CLONE_ARG_TYPE_VECTOR)
        {
          /* No adjustment necessary for scalar arguments.  */
-         adj.copy_param = 1;
+         adj.op = IPA_PARM_OP_COPY;
        }
       else
        {
@@ -11649,6 +11649,7 @@ simd_clone_adjust_argument_types (struct cgraph_node 
*node)
                                     TREE_TYPE (parm),
                                     node->simdclone->simdlen);
        }
+      adj.arg_prefix = "simd";
       adjustments.quick_push (adj);
     }
 
@@ -11657,8 +11658,8 @@ simd_clone_adjust_argument_types (struct cgraph_node 
*node)
       struct ipa_parm_adjustment adj;
 
       memset (&adj, 0, sizeof (adj));
-      adj.new_param = 1;
-      adj.new_arg_prefix = "mask";
+      adj.op = IPA_PARM_OP_NEW;
+      adj.arg_prefix = "mask";
       adj.base_index = i;
       adj.type
        = build_vector_type (integer_type_node, node->simdclone->simdlen);
@@ -11674,7 +11675,7 @@ simd_clone_adjust_argument_types (struct cgraph_node 
*node)
        = create_tmp_simd_array ("mask", integer_type_node, sc->simdlen);
     }
 
-  ipa_modify_formal_parameters (node->decl, adjustments, "simd");
+  ipa_modify_formal_parameters (node->decl, adjustments);
   return adjustments;
 }
 
@@ -11693,7 +11694,7 @@ simd_clone_init_simd_arrays (struct cgraph_node *node,
        arg;
        arg = DECL_CHAIN (arg), i++)
     {
-      if (adjustments[i].copy_param)
+      if (adjustments[i].op == IPA_PARM_OP_COPY)
        continue;
 
       node->simdclone->args[i].vector_arg = arg;
@@ -11749,7 +11750,7 @@ ipa_simd_modify_stmt_ops (tree *tp, int *walk_subtrees, 
void *data)
   gimple_stmt_iterator gsi = gsi_for_stmt (info->stmt);
   if (wi->is_lhs)
     {
-      stmt = gimple_build_assign (unshare_expr (cand->reduction), repl);
+      stmt = gimple_build_assign (unshare_expr (cand->new_decl), repl);
       gsi_insert_after (&gsi, stmt, GSI_SAME_STMT);
       SSA_NAME_DEF_STMT (repl) = info->stmt;
     }
@@ -11759,7 +11760,7 @@ ipa_simd_modify_stmt_ops (tree *tp, int *walk_subtrees, 
void *data)
         wi->val_only=true, but we may have `*var' which will get
         replaced into `*var_array[iter]' and will likely be something
         not gimple.  */
-      stmt = gimple_build_assign (repl, unshare_expr (cand->reduction));
+      stmt = gimple_build_assign (repl, unshare_expr (cand->new_decl));
       gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
     }
 
@@ -11802,7 +11803,7 @@ ipa_simd_modify_function_body (struct cgraph_node *node,
        continue;
 
       tree basetype = TREE_TYPE (node->simdclone->args[i].orig_arg);
-      adjustments[i].reduction
+      adjustments[i].new_decl
        = build4 (ARRAY_REF,
                  basetype,
                  node->simdclone->args[i].simd_array,
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 36994f7..2f19899 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -4271,9 +4271,10 @@ turn_representatives_into_adjustments (vec<access_p> 
representatives,
          adj.base_index = get_param_index (parm, parms);
          adj.base = parm;
          if (!repr)
-           adj.copy_param = 1;
+           adj.op = IPA_PARM_OP_COPY;
          else
-           adj.remove_param = 1;
+           adj.op = IPA_PARM_OP_REMOVE;
+         adj.arg_prefix = "ISRA";
          adjustments.quick_push (adj);
        }
       else
@@ -4293,6 +4294,7 @@ turn_representatives_into_adjustments (vec<access_p> 
representatives,
              adj.by_ref = (POINTER_TYPE_P (TREE_TYPE (repr->base))
                            && (repr->grp_maybe_modified
                                || repr->grp_not_necessarilly_dereferenced));
+             adj.arg_prefix = "ISRA";
              adjustments.quick_push (adj);
            }
        }
@@ -4423,7 +4425,7 @@ get_adjustment_for_base (ipa_parm_adjustment_vec 
adjustments, tree base)
       struct ipa_parm_adjustment *adj;
 
       adj = &adjustments[i];
-      if (!adj->copy_param && adj->base == base)
+      if (adj->op != IPA_PARM_OP_COPY && adj->base == base)
        return adj;
     }
 
@@ -4534,14 +4536,14 @@ sra_ipa_get_adjustment_candidate (tree *&expr, bool 
*convert,
       struct ipa_parm_adjustment *adj = &adjustments[i];
 
       if (adj->base == base
-         && (adj->offset == offset || adj->remove_param))
+         && (adj->offset == offset || adj->op == IPA_PARM_OP_REMOVE))
        {
          cand = adj;
          break;
        }
     }
 
-  if (!cand || cand->copy_param || cand->remove_param)
+  if (!cand || cand->op == IPA_PARM_OP_COPY || cand->op == IPA_PARM_OP_REMOVE)
     return NULL;
   return cand;
 }
@@ -4564,9 +4566,9 @@ sra_ipa_modify_expr (tree *expr, bool convert,
 
   tree src;
   if (cand->by_ref)
-    src = build_simple_mem_ref (cand->reduction);
+    src = build_simple_mem_ref (cand->new_decl);
   else
-    src = cand->reduction;
+    src = cand->new_decl;
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
@@ -4760,7 +4762,7 @@ sra_ipa_reset_debug_stmts (ipa_parm_adjustment_vec 
adjustments)
       use_operand_p use_p;
 
       adj = &adjustments[i];
-      if (adj->copy_param || !is_gimple_reg (adj->base))
+      if (adj->op == IPA_PARM_OP_COPY || !is_gimple_reg (adj->base))
        continue;
       name = ssa_default_def (cfun, adj->base);
       vexpr = NULL;
@@ -4943,7 +4945,7 @@ modify_function (struct cgraph_node *node, 
ipa_parm_adjustment_vec adjustments)
   redirect_callers.release ();
 
   push_cfun (DECL_STRUCT_FUNCTION (new_node->decl));
-  ipa_modify_formal_parameters (current_function_decl, adjustments, "ISRA");
+  ipa_modify_formal_parameters (current_function_decl, adjustments);
   cfg_changed = ipa_sra_modify_function_body (adjustments);
   sra_ipa_reset_debug_stmts (adjustments);
   convert_callers (new_node, node->decl, adjustments);

Reply via email to