From fca4adf2095dfcd453ab32250984d85ff66bbd32 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 5 Jan 2015 22:47:51 +0100 Subject: re PR sanitizer/64265 (r217669 broke tsan) PR sanitizer/64265 * gimplify.c (gimplify_function_tree): Add TSAN_FUNC_EXIT internal call as cleanup of the whole body. * internal-fn.def (TSAN_FUNC_EXIT): New internal call. * tsan.c (replace_func_exit): New function. (instrument_func_exit): Moved earlier. (instrument_memory_accesses): Adjust TSAN_FUNC_EXIT internal calls. Call instrument_func_exit if no TSAN_FUNC_EXIT internal calls have been found. (tsan_pass): Don't call instrument_func_exit. * internal-fn.c (expand_TSAN_FUNC_EXIT): New function. * tree-inline.c (copy_bb): Drop TSAN_FUNC_EXIT internal calls during inlining. From-SVN: r219202 --- gcc/tree-inline.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'gcc/tree-inline.c') diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 902eb955d39..5518d404ff9 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1907,7 +1907,7 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale, gsi_replace (©_gsi, new_call, false); stmt = new_call; } - else if (is_gimple_call (stmt) + else if (call_stmt && id->call_stmt && (decl = gimple_call_fndecl (stmt)) && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL @@ -1934,6 +1934,15 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale, gsi_replace (©_gsi, new_stmt, false); stmt = new_stmt; } + else if (call_stmt + && id->call_stmt + && gimple_call_internal_p (stmt) + && gimple_call_internal_fn (stmt) == IFN_TSAN_FUNC_EXIT) + { + /* Drop TSAN_FUNC_EXIT () internal calls during inlining. */ + gsi_remove (©_gsi, false); + continue; + } /* Statements produced by inlining can be unfolded, especially when we constant propagated some operands. We can't fold -- cgit v1.2.1