From 532b24ed7917e691b34b171aecc343294fa2cbea Mon Sep 17 00:00:00 2001 From: davidxl Date: Fri, 9 May 2014 23:41:43 +0000 Subject: [PATCH] port r210293 from v18 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/google@210294 138bc75d-0d04-0410-961f-82ee72b054a4 --- main/gcc/ipa-inline.c | 3 +++ main/gcc/ipa-prop.c | 9 +++++++-- main/gcc/tree-inline.c | 16 ++++++++++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/main/gcc/ipa-inline.c b/main/gcc/ipa-inline.c index 5adec075eec..9a80db5106c 100644 --- a/main/gcc/ipa-inline.c +++ b/main/gcc/ipa-inline.c @@ -1937,6 +1937,9 @@ inline_small_functions (void) continue; } + if (!dbg_cnt (inl)) + continue; + /* Heuristics for inlining small functions work poorly for recursive calls where we do effects similar to loop unrolling. When inlining such edge seems profitable, leave decision on diff --git a/main/gcc/ipa-prop.c b/main/gcc/ipa-prop.c index 0f431011f44..34b67f98333 100644 --- a/main/gcc/ipa-prop.c +++ b/main/gcc/ipa-prop.c @@ -1623,8 +1623,13 @@ ipa_compute_jump_functions_for_edge (struct param_analysis_info *parms_ainfo, if (L_IPO_COMP_MODE && TREE_CODE (arg) == ADDR_EXPR && TREE_CODE (TREE_OPERAND (arg, 0)) == FUNCTION_DECL) { - arg = TREE_OPERAND (arg, 0); - arg = cgraph_lipo_get_resolved_node (arg)->decl; + tree fdecl = TREE_OPERAND (arg, 0); + tree real_fdecl = cgraph_lipo_get_resolved_node (fdecl)->decl; + if (fdecl != real_fdecl) + { + arg = unshare_expr (arg); + TREE_OPERAND (arg, 0) = real_fdecl; + } } ipa_set_jf_constant (jfunc, arg, cs); } diff --git a/main/gcc/tree-inline.c b/main/gcc/tree-inline.c index 20c66707c3e..06da0f69ff5 100644 --- a/main/gcc/tree-inline.c +++ b/main/gcc/tree-inline.c @@ -2643,8 +2643,20 @@ copy_debug_stmt (gimple stmt, copy_body_data *id) gimple_debug_bind_set_var (stmt, t); if (gimple_debug_bind_has_value_p (stmt)) - walk_tree (gimple_debug_bind_get_value_ptr (stmt), - remap_gimple_op_r, &wi, NULL); + { + tree v = gimple_debug_bind_get_value (stmt); + if (TREE_CODE (v) == ADDR_EXPR) + v = TREE_OPERAND (v, 0); + + /* The global var may be deleted */ + if (L_IPO_COMP_MODE && + ((TREE_CODE (v) != VAR_DECL) + || is_global_var (v))) + processing_debug_stmt = -1; + else + walk_tree (gimple_debug_bind_get_value_ptr (stmt), + remap_gimple_op_r, &wi, NULL); + } /* Punt if any decl couldn't be remapped. */ if (processing_debug_stmt < 0) -- 2.11.4.GIT