On 09/27/13 09:23, Jakub Jelinek wrote:
On Thu, Sep 26, 2013 at 02:31:33PM -0500, Aldy Hernandez wrote:

+/* Create a simd clone of OLD_NODE and return it.  */
+
+static struct cgraph_node *
+simd_clone_create (struct cgraph_node *old_node)
+{
+  struct cgraph_node *new_node;
+  new_node = cgraph_function_versioning (old_node, vNULL, NULL, NULL, false,
+                                        NULL, NULL, "simdclone");
+

My understanding of how IPA cloning etc. works is that you first
set up various data structures describing how you change the arguments
and only then actually do cgraph_function_versioning which already during
the copying will do some of the transformations of the IL.
But perhaps those transformations are too complicated to describe for
tree-inline.c to make them for you.

For the record, the way this works (at least for tree-sra) is that you do the cgraph cloning first, and then call ipa_modify_formal_parameters() with an adjustments vector. This function, in ipa-prop.c, seems to be only used for SRA.

ipa_modify_formal_parameters() doesn't handle adding new arguments out of the blue, only changing parameter types, removing them altogether, or leaving them as is. My plan is to enhance this to handle adding new parameters (for the masked argument for simd-enabled functions / elementals).

But anyways... ipa_modify_formal_parameters() seems like the more elegant solution for modifying argument types after cloning.

Aldy

Reply via email to