+2017-02-03 Martin Liska <mliska@suse.cz>
+
+ PR lto/66295
+ * multiple_target.c (create_dispatcher_calls): Redirect edge
+ from a caller of a dispatcher.
+ (expand_target_clones): Make the clones local.
+ (ipa_target_clone): Do both target clones and resolvers.
+ (ipa_dispatcher_calls): Remove the pass.
+ (pass_dispatcher_calls::gate): Likewise.
+ (make_pass_dispatcher_calls): Likewise.
+ * passes.def (pass_target_clone): Put as very first IPA early
+ pass.
+
2017-02-03 Martin Liska <mliska@suse.cz>
* symtab.c (symtab_node::binds_to_current_def_p): Bail out
inode->resolve_alias (cgraph_node::get (resolver_decl));
e->redirect_callee (inode);
+ e->redirect_call_stmt_to_callee ();
/* Since REDIRECT_CALLEE modifies NEXT_CALLER field we move to
previously set NEXT_CALLER. */
e = NULL;
create_new_asm_name (attr, suffix);
/* Create new target clone. */
cgraph_node *new_node = create_target_clone (node, definition, suffix);
+ new_node->local.local = false;
XDELETEVEC (suffix);
/* Set new attribute for the clone. */
return ret;
}
-static bool target_clone_pass;
-
static unsigned int
ipa_target_clone (void)
{
struct cgraph_node *node;
- target_clone_pass = false;
+ bool target_clone_pass = false;
FOR_EACH_FUNCTION (node)
- if (node->definition)
- target_clone_pass |= expand_target_clones (node, true);
+ target_clone_pass |= expand_target_clones (node, node->definition);
+
+ if (target_clone_pass)
+ FOR_EACH_FUNCTION (node)
+ create_dispatcher_calls (node);
+
return 0;
}
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
- 0 /* todo_flags_finish */
+ TODO_update_ssa /* todo_flags_finish */
};
class pass_target_clone : public simple_ipa_opt_pass
{
return new pass_target_clone (ctxt);
}
-
-static unsigned int
-ipa_dispatcher_calls (void)
-{
- struct cgraph_node *node;
-
- FOR_EACH_FUNCTION (node)
- if (!node->definition)
- target_clone_pass |= expand_target_clones (node, false);
- if (target_clone_pass)
- FOR_EACH_FUNCTION (node)
- create_dispatcher_calls (node);
- return 0;
-}
-
-namespace {
-
-const pass_data pass_data_dispatcher_calls =
-{
- SIMPLE_IPA_PASS, /* type */
- "dispatchercalls", /* name */
- OPTGROUP_NONE, /* optinfo_flags */
- TV_NONE, /* tv_id */
- ( PROP_ssa | PROP_cfg ), /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- 0 /* todo_flags_finish */
-};
-
-class pass_dispatcher_calls : public simple_ipa_opt_pass
-{
-public:
- pass_dispatcher_calls (gcc::context *ctxt)
- : simple_ipa_opt_pass (pass_data_dispatcher_calls, ctxt)
- {}
-
- /* opt_pass methods: */
- virtual bool gate (function *);
- virtual unsigned int execute (function *) { return ipa_dispatcher_calls (); }
-};
-
-bool
-pass_dispatcher_calls::gate (function *)
-{
- return true;
-}
-
-} // anon namespace
-
-simple_ipa_opt_pass *
-make_pass_dispatcher_calls (gcc::context *ctxt)
-{
- return new pass_dispatcher_calls (ctxt);
-}
POP_INSERT_PASSES ()
POP_INSERT_PASSES ()
+ NEXT_PASS (pass_target_clone);
NEXT_PASS (pass_ipa_chkp_produce_thunks);
NEXT_PASS (pass_ipa_auto_profile);
NEXT_PASS (pass_ipa_free_inline_summary);
NEXT_PASS (pass_ipa_devirt);
NEXT_PASS (pass_ipa_cp);
NEXT_PASS (pass_ipa_cdtor_merge);
- NEXT_PASS (pass_target_clone);
NEXT_PASS (pass_ipa_hsa);
NEXT_PASS (pass_ipa_inline);
NEXT_PASS (pass_ipa_pure_const);
INSERT_PASSES_AFTER (all_late_ipa_passes)
NEXT_PASS (pass_materialize_all_clones);
NEXT_PASS (pass_ipa_pta);
- NEXT_PASS (pass_dispatcher_calls);
NEXT_PASS (pass_omp_simd_clone);
TERMINATE_PASS_LIST (all_late_ipa_passes)