From db66bf68a1cd1d417000032cc255dfe177ce50fc Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sun, 12 Apr 2015 07:44:52 +0200 Subject: re PR middle-end/65743 (LTO+FDO build of Firefox crashes at startup) PR ipa/65743 * ipa-inline-transform.c (speculation_removed): Remove static var. (check_speculations): New function. (clone_inlined_nodes): Do not check spculations. (inline_call): Call check_speculations. * ipa-prop.c (ipa_make_edge_direct_to_target): Do not consider non-invariants. From-SVN: r222017 --- gcc/ipa-prop.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'gcc/ipa-prop.c') diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 89a4623..dc8f360 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -2626,9 +2626,29 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target, target = canonicalize_constructor_val (target, NULL); if (!target || TREE_CODE (target) != FUNCTION_DECL) { - if (ie->indirect_info->member_ptr) - /* Member pointer call that goes through a VMT lookup. */ - return NULL; + /* Member pointer call that goes through a VMT lookup. */ + if (ie->indirect_info->member_ptr + /* Or if target is not an invariant expression and we do not + know if it will evaulate to function at runtime. + This can happen when folding through &VAR, where &VAR + is IP invariant, but VAR itself is not. + + TODO: Revisit this when GCC 5 is branched. It seems that + member_ptr check is not needed and that we may try to fold + the expression and see if VAR is readonly. */ + || !is_gimple_ip_invariant (target)) + { + if (dump_enabled_p ()) + { + location_t loc = gimple_location_safe (ie->call_stmt); + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc, + "discovered direct call non-invariant " + "%s/%i\n", + ie->caller->name (), ie->caller->order); + } + return NULL; + } + if (dump_enabled_p ()) { -- cgit v1.1