diff options
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r-- | gcc/ipa-cp.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 4202c999675..ee41a8d55b7 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -630,6 +630,24 @@ determine_versionability (struct cgraph_node *node, reason = "calls comdat-local function"; } + /* Functions calling BUILT_IN_VA_ARG_PACK and BUILT_IN_VA_ARG_PACK_LEN + work only when inlined. Cloning them may still lead to better code + because ipa-cp will not give up on cloning further. If the function is + external this however leads to wrong code because we may end up producing + offline copy of the function. */ + if (DECL_EXTERNAL (node->decl)) + for (cgraph_edge *edge = node->callees; !reason && edge; + edge = edge->next_callee) + if (DECL_BUILT_IN (edge->callee->decl) + && DECL_BUILT_IN_CLASS (edge->callee->decl) == BUILT_IN_NORMAL) + { + if (DECL_FUNCTION_CODE (edge->callee->decl) == BUILT_IN_VA_ARG_PACK) + reason = "external function which calls va_arg_pack"; + if (DECL_FUNCTION_CODE (edge->callee->decl) + == BUILT_IN_VA_ARG_PACK_LEN) + reason = "external function which calls va_arg_pack_len"; + } + if (reason && dump_file && !node->alias && !node->thunk.thunk_p) fprintf (dump_file, "Function %s is not versionable, reason: %s.\n", node->dump_name (), reason); |