diff options
author | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2018-03-06 20:04:36 +0000 |
---|---|---|
committer | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2018-03-06 20:04:36 +0000 |
commit | de5c5180c21392d7324863f4cda9b4e9da298e8f (patch) | |
tree | 513c38fa2d010bedf6882d5670f2d382251928ba | |
parent | 1c49d3f3a1b1bf6cd7c853d188e2df13b9774584 (diff) | |
download | gcc-de5c5180c21392d7324863f4cda9b4e9da298e8f.tar.gz |
Backport r257877
2018-03-06 Martin Liska <mliska@suse.cz>
Backport from mainline
2018-02-21 Jan Hubicka <hubicka@ucw.cz>
PR c/84229
* ipa-cp.c (determine_versionability): Do not version functions caling
va_arg_pack.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@258290 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/ipa-cp.c | 18 |
2 files changed, 27 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e780652c3ba..31609c64c32 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,15 @@ 2018-03-06 Martin Liska <mliska@suse.cz> Backport from mainline + 2018-02-21 Jan Hubicka <hubicka@ucw.cz> + + PR c/84229 + * ipa-cp.c (determine_versionability): Do not version functions caling + va_arg_pack. + +2018-03-06 Martin Liska <mliska@suse.cz> + + Backport from mainline 2018-02-08 Jan Hubicka <hubicka@ucw.cz> PR ipa/81360 diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 716c8cc3a1f..f5dcfc0341b 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -621,6 +621,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 + works only when inlined. Cloning them may still lead to better code + becuase ipa-cp will not give up on cloning further. If the function is + external this however leads to wrong code becuase 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/%i is not versionable, reason: %s.\n", node->name (), node->order, reason); |