From 255c58a9276d4680bbc81c51c42292459dda7b69 Mon Sep 17 00:00:00 2001 From: davidxl Date: Wed, 27 Apr 2011 16:18:08 +0000 Subject: backport fixes from google/main git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/lw-ipo@173041 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cgraph.c | 29 ++++------------------------- gcc/coverage.c | 4 ++-- gcc/ipa-inline.c | 2 +- gcc/tree-profile.c | 11 +++++++---- 4 files changed, 14 insertions(+), 32 deletions(-) diff --git a/gcc/cgraph.c b/gcc/cgraph.c index c11e7558818..bb85e34658c 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -1005,13 +1005,7 @@ initialize_inline_failed (struct cgraph_edge *e) e->inline_failed = CIF_REDEFINED_EXTERN_INLINE; else if (!callee->local.inlinable) e->inline_failed = CIF_FUNCTION_NOT_INLINABLE; - else if (!e->call_stmt) - { - /* artifcial edge. */ - gcc_assert (L_IPO_COMP_MODE); - e->inline_failed = CIF_ARTIFICIAL_EDGE; - } - else if (gimple_call_cannot_inline_p (e->call_stmt)) + else if (e->call_stmt && gimple_call_cannot_inline_p (e->call_stmt)) e->inline_failed = CIF_MISMATCHED_ARGUMENTS; else e->inline_failed = CIF_FUNCTION_NOT_CONSIDERED; @@ -2297,15 +2291,9 @@ cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq, return new_node; } -/* Hash table used to convert assembler names into next available clone id. */ -static htab_t clone_assembler_name_hash; +/* Create a new name for clone of DECL, add SUFFIX. Returns an identifier. */ -/* For the hash table. */ -static int -string_hash_eq (const void *y1, const void *y2) -{ - return strcmp ((const char *) y1, (const char *) y2) == 0; -} +static GTY(()) unsigned int clone_fn_id_num; tree clone_function_name (tree decl, const char *suffix) @@ -2313,7 +2301,6 @@ clone_function_name (tree decl, const char *suffix) tree name = DECL_ASSEMBLER_NAME (decl); size_t len = IDENTIFIER_LENGTH (name); char *tmp_name, *prefix; - unsigned int **clone_fn_id_num; prefix = XALLOCAVEC (char, len + strlen (suffix) + 2); memcpy (prefix, IDENTIFIER_POINTER (name), len); @@ -2325,15 +2312,7 @@ clone_function_name (tree decl, const char *suffix) #else prefix[len] = '_'; #endif - if (!clone_assembler_name_hash) - clone_assembler_name_hash = - htab_create (512, htab_hash_string, string_hash_eq, NULL); - clone_fn_id_num = (unsigned int **) htab_find_slot - (clone_assembler_name_hash, IDENTIFIER_POINTER (name), INSERT); - if (!*clone_fn_id_num) - *clone_fn_id_num = - (unsigned int *) ggc_alloc_cleared_atomic (sizeof (unsigned int)); - ASM_FORMAT_PRIVATE_NAME (tmp_name, prefix, **clone_fn_id_num++); + ASM_FORMAT_PRIVATE_NAME (tmp_name, prefix, clone_fn_id_num++); return get_identifier (tmp_name); } diff --git a/gcc/coverage.c b/gcc/coverage.c index c1d9216be76..b34ad88d731 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -923,7 +923,7 @@ coverage_end_function (void) { struct function_list *item; - item = XNEW (struct function_list); + item = XCNEW (struct function_list); *functions_tail = item; functions_tail = &item->next; @@ -973,7 +973,7 @@ coverage_dc_end_function (void) if (!item) { int i; - item = XNEW (struct function_list); + item = XCNEW (struct function_list); *functions_tail = item; functions_tail = &item->next; item->next = 0; diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 252303d5151..06b27cd52a2 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -310,7 +310,7 @@ cgraph_mark_inline_edge (struct cgraph_edge *e, bool update_original, int freq; /* Skip fake edge. */ - if (!e->call_stmt) + if (L_IPO_COMP_MODE && !e->call_stmt) return false; /* Don't inline inlined edges. */ diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c index f49268e082b..f27e9228d53 100644 --- a/gcc/tree-profile.c +++ b/gcc/tree-profile.c @@ -45,6 +45,7 @@ along with GCC; see the file COPYING3. If not see #include "cgraph.h" #include "output.h" #include "l-ipo.h" +#include "target.h" static GTY(()) tree gcov_type_node; static GTY(()) tree gcov_type_tmp_var; @@ -91,8 +92,9 @@ init_ic_make_global_vars (void) ptr_void); TREE_PUBLIC (ic_void_ptr_var) = 1; DECL_EXTERNAL (ic_void_ptr_var) = 1; - DECL_TLS_MODEL (ic_void_ptr_var) = - decl_default_tls_model (ic_void_ptr_var); + if (targetm.have_tls) + DECL_TLS_MODEL (ic_void_ptr_var) = + decl_default_tls_model (ic_void_ptr_var); gcov_type_ptr = build_pointer_type (get_gcov_type ()); ic_gcov_type_ptr_var @@ -101,8 +103,9 @@ init_ic_make_global_vars (void) gcov_type_ptr); TREE_PUBLIC (ic_gcov_type_ptr_var) = 1; DECL_EXTERNAL (ic_gcov_type_ptr_var) = 1; - DECL_TLS_MODEL (ic_gcov_type_ptr_var) = - decl_default_tls_model (ic_gcov_type_ptr_var); + if (targetm.have_tls) + DECL_TLS_MODEL (ic_gcov_type_ptr_var) = + decl_default_tls_model (ic_gcov_type_ptr_var); } else { -- cgit v1.2.1