From 45aee888b558bbf042ab53c88005148e44d0e1b1 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 31 Aug 2015 11:48:11 +0000 Subject: [PATCH] lto-symtab.c (lto_symtab_prevailing_decl): Remove redundant test, do not replace a non-builtin with a builtin. 2015-08-31 Richard Biener lto/ * lto-symtab.c (lto_symtab_prevailing_decl): Remove redundant test, do not replace a non-builtin with a builtin. * lto.c (compare_tree_sccs_1): Do not merge things we stream as builtins vs. non-builtins. From-SVN: r227339 --- gcc/lto/ChangeLog | 7 +++++++ gcc/lto/lto-symtab.c | 9 ++++----- gcc/lto/lto.c | 6 ++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 6f5ab78ca45..56dcfa8f3c0 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,10 @@ +2015-08-31 Richard Biener + + * lto-symtab.c (lto_symtab_prevailing_decl): Remove redundant + test, do not replace a non-builtin with a builtin. + * lto.c (compare_tree_sccs_1): Do not merge things we stream + as builtins vs. non-builtins. + 2015-08-18 Trevor Saunders * lto.h: Remove useless typedefs. diff --git a/gcc/lto/lto-symtab.c b/gcc/lto/lto-symtab.c index 979579f4f16..d50a1abd3a0 100644 --- a/gcc/lto/lto-symtab.c +++ b/gcc/lto/lto-symtab.c @@ -798,11 +798,6 @@ lto_symtab_prevailing_decl (tree decl) if (TREE_CODE (decl) == FUNCTION_DECL && DECL_ABSTRACT_P (decl)) return decl; - /* Likewise builtins are their own prevailing decl. This preserves - non-builtin vs. builtin uses from compile-time. */ - if (TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl)) - return decl; - /* Ensure DECL_ASSEMBLER_NAME will not set assembler name. */ gcc_assert (DECL_ASSEMBLER_NAME_SET_P (decl)); @@ -811,5 +806,9 @@ lto_symtab_prevailing_decl (tree decl) if (!ret) return decl; + /* Do not replace a non-builtin with a builtin. */ + if (is_builtin_fn (ret->decl)) + return decl; + return ret->decl; } diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 7ec4c08a39e..b4287a358f8 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -1054,8 +1054,10 @@ compare_tree_sccs_1 (tree t1, tree t2, tree **map) return false; - /* We don't want to compare locations, so there is nothing do compare - for TS_DECL_MINIMAL. */ + /* We want to compare locations up to the point where it makes + a difference for streaming - thus whether the decl is builtin or not. */ + if (CODE_CONTAINS_STRUCT (code, TS_DECL_MINIMAL)) + compare_values (streamer_handle_as_builtin_p); if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) { -- 2.30.2