Hi, This patch does not allow splitting in case bounds are returned until retutrned bounds are supported. It also propagates instrumentation marks for generated call and function.
Bootstrapped and tested on linux-x86_64. Thanks, Ilya -- gcc/ 2014-06-03 Ilya Enkovich <ilya.enkov...@intel.com> * ipa-split.c: Include tree-chkp.h. (consider_split): Do not split when return bounds. (split_function): Propagate Pointer Bounds Checker instrumentation marks. diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index 38bd883..edf322f 100644 --- a/gcc/ipa-split.c +++ b/gcc/ipa-split.c @@ -110,6 +110,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-pretty-print.h" #include "ipa-inline.h" #include "cfgloop.h" +#include "tree-chkp.h" /* Per basic block info. */ @@ -496,6 +497,19 @@ consider_split (struct split_point *current, bitmap non_ssa_vars, if (!VOID_TYPE_P (TREE_TYPE (current_function_decl))) call_overhead += estimate_move_cost (TREE_TYPE (current_function_decl)); + /* Currently returned value is processed but returned bounds + are not processed. It results in bounds in return statement + with no definition. Forbid split until returned bounds are + supported. */ + if (chkp_function_instrumented_p (current_function_decl) + && chkp_type_has_pointer (TREE_TYPE (TREE_TYPE (current_function_decl)))) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, + " Refused: need to return bounds\n"); + return; + } + if (current->split_size <= call_overhead) { if (dump_file && (dump_flags & TDF_DETAILS)) @@ -1096,6 +1110,7 @@ split_function (struct split_point *split_point) edge_iterator ei; tree retval = NULL, real_retval = NULL; bool split_part_return_p = false; + bool with_bounds = chkp_function_instrumented_p (current_function_decl); gimple last_stmt = NULL; unsigned int i; tree arg, ddef; @@ -1248,6 +1263,12 @@ split_function (struct split_point *split_point) DECL_BUILT_IN_CLASS (node->decl) = NOT_BUILT_IN; DECL_FUNCTION_CODE (node->decl) = (enum built_in_function) 0; } + + /* If the original function is instrumented then it's + part is also instrumented. */ + if (with_bounds) + chkp_function_mark_instrumented (node->decl); + /* If the original function is declared inline, there is no point in issuing a warning for the non-inlinable part. */ DECL_NO_INLINE_WARNING_P (node->decl) = 1; @@ -1282,6 +1303,7 @@ split_function (struct split_point *split_point) args_to_pass[i] = arg; } call = gimple_build_call_vec (node->decl, args_to_pass); + gimple_call_set_with_bounds (call, with_bounds); gimple_set_block (call, DECL_INITIAL (current_function_decl)); args_to_pass.release ();