From ce2d198d93cf01609d4d18ce934efacc0cf21b5b Mon Sep 17 00:00:00 2001 From: hubicka Date: Wed, 26 Mar 2014 02:07:51 +0000 Subject: [PATCH] * ipa-pure-const.c (propagate_pure_const, propagate_nothrow): Do not modify inline clones. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208830 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 ++++ gcc/ipa-pure-const.c | 72 ++++++++++++++++++++++++++++++---------------------- 2 files changed, 46 insertions(+), 31 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 596e25d96d2..bc74777659b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-03-25 Jan Hubicka + + * ipa-pure-const.c (propagate_pure_const, propagate_nothrow): + Do not modify inline clones. + 2014-03-25 Jakub Jelinek * config/i386/i386.md (general_sext_operand): New mode attr. diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index 296f9c07bb1..7d358809965 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -1327,35 +1327,39 @@ propagate_pure_const (void) w_l->pure_const_state = this_state; w_l->looping = this_looping; - switch (this_state) - { - case IPA_CONST: - if (!TREE_READONLY (w->decl)) - { - warn_function_const (w->decl, !this_looping); - if (dump_file) - fprintf (dump_file, "Function found to be %sconst: %s\n", - this_looping ? "looping " : "", - w->name ()); - } - cgraph_set_const_flag (w, true, this_looping); - break; + /* Inline clones share declaration with their offline copies; + do not modify their declarations since the offline copy may + be different. */ + if (!w->global.inlined_to) + switch (this_state) + { + case IPA_CONST: + if (!TREE_READONLY (w->decl)) + { + warn_function_const (w->decl, !this_looping); + if (dump_file) + fprintf (dump_file, "Function found to be %sconst: %s\n", + this_looping ? "looping " : "", + w->name ()); + } + cgraph_set_const_flag (w, true, this_looping); + break; - case IPA_PURE: - if (!DECL_PURE_P (w->decl)) - { - warn_function_pure (w->decl, !this_looping); - if (dump_file) - fprintf (dump_file, "Function found to be %spure: %s\n", - this_looping ? "looping " : "", - w->name ()); - } - cgraph_set_pure_flag (w, true, this_looping); - break; + case IPA_PURE: + if (!DECL_PURE_P (w->decl)) + { + warn_function_pure (w->decl, !this_looping); + if (dump_file) + fprintf (dump_file, "Function found to be %spure: %s\n", + this_looping ? "looping " : "", + w->name ()); + } + cgraph_set_pure_flag (w, true, this_looping); + break; - default: - break; - } + default: + break; + } w_info = (struct ipa_dfs_info *) w->aux; w = w_info->next_cycle; } @@ -1448,10 +1452,16 @@ propagate_nothrow (void) funct_state w_l = get_function_state (w); if (!can_throw && !TREE_NOTHROW (w->decl)) { - cgraph_set_nothrow_flag (w, true); - if (dump_file) - fprintf (dump_file, "Function found to be nothrow: %s\n", - w->name ()); + /* Inline clones share declaration with their offline copies; + do not modify their declarations since the offline copy may + be different. */ + if (!w->global.inlined_to) + { + cgraph_set_nothrow_flag (w, true); + if (dump_file) + fprintf (dump_file, "Function found to be nothrow: %s\n", + w->name ()); + } } else if (can_throw && !TREE_NOTHROW (w->decl)) w_l->can_throw = true; -- 2.11.4.GIT