From: hubicka Date: Mon, 17 May 2010 07:01:26 +0000 (+0000) Subject: * ipa-cp.c (ipcp_versionable_function_p): Walk cgraph edges instead of X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70a8f5acc1afd8522b94f2baad01b7baef8d10c5;p=thirdparty%2Fgcc.git * ipa-cp.c (ipcp_versionable_function_p): Walk cgraph edges instead of function body; do not check stdarg field of struct function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159472 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cfb3a7f1a733..e5d09425ec9c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2010-05-16 Jan Hubicka + + * ipa-cp.c (ipcp_versionable_function_p): Walk cgraph edges instead of + function body; do not check stdarg field of struct function. + 2010-05-16 Jan Hubicka * cgraph.c (dump_cgraph_node): Dump versionable flag. diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 88a5b4fffc63..723de162b1f2 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -416,35 +416,21 @@ ipcp_print_all_lattices (FILE * f) static bool ipcp_versionable_function_p (struct cgraph_node *node) { - tree decl = node->decl; - basic_block bb; + struct cgraph_edge *edge; /* There are a number of generic reasons functions cannot be versioned. */ if (!node->local.versionable) return false; - /* Removing arguments doesn't work if the function takes varargs. */ - if (DECL_STRUCT_FUNCTION (decl)->stdarg) - return false; - - /* Removing arguments doesn't work if we use __builtin_apply_args. */ - FOR_EACH_BB_FN (bb, DECL_STRUCT_FUNCTION (decl)) + /* Removing arguments doesn't work if the function takes varargs + or use __builtin_apply_args. */ + for (edge = node->callees; edge; edge = edge->next_callee) { - gimple_stmt_iterator gsi; - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - { - const_gimple stmt = gsi_stmt (gsi); - tree t; - - if (!is_gimple_call (stmt)) - continue; - t = gimple_call_fndecl (stmt); - if (t == NULL_TREE) - continue; - if (DECL_BUILT_IN_CLASS (t) == BUILT_IN_NORMAL - && DECL_FUNCTION_CODE (t) == BUILT_IN_APPLY_ARGS) - return false; - } + tree t = edge->callee->decl; + if (DECL_BUILT_IN_CLASS (t) == BUILT_IN_NORMAL + && (DECL_FUNCTION_CODE (t) == BUILT_IN_APPLY_ARGS + || DECL_FUNCTION_CODE (t) == BUILT_IN_VA_START)) + return false; } return true;