summaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c130
1 files changed, 11 insertions, 119 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index ae36cc710fd..ca4dc321d20 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -57,7 +57,6 @@ along with GCC; see the file COPYING3. If not see
#include "value-prof.h"
#include "cfgloop.h"
#include "builtins.h"
-#include "tree-chkp.h"
#include "stringpool.h"
#include "attribs.h"
#include "sreal.h"
@@ -122,7 +121,7 @@ eni_weights eni_time_weights;
/* Prototypes. */
-static tree declare_return_variable (copy_body_data *, tree, tree, tree,
+static tree declare_return_variable (copy_body_data *, tree, tree,
basic_block);
static void remap_block (tree *, copy_body_data *);
static void copy_bind_expr (tree *, int *, copy_body_data *);
@@ -1403,15 +1402,6 @@ remap_gimple_stmt (gimple *stmt, copy_body_data *id)
retval);
/* id->retvar is already substituted. Skip it on later remapping. */
skip_first = true;
-
- /* We need to copy bounds if return structure with pointers into
- instrumented function. */
- if (chkp_function_instrumented_p (id->dst_fn)
- && !bndslot
- && !BOUNDED_P (id->retvar)
- && chkp_type_has_pointer (TREE_TYPE (id->retvar)))
- id->assign_stmts.safe_push (copy);
-
}
else
return stmts;
@@ -1889,29 +1879,13 @@ copy_bb (copy_body_data *id, basic_block bb,
gcall *new_call;
vec<tree> argarray;
size_t nargs = gimple_call_num_args (id->call_stmt);
- size_t n, i, nargs_to_copy;
- bool remove_bounds = false;
+ size_t n;
for (p = DECL_ARGUMENTS (id->src_fn); p; p = DECL_CHAIN (p))
nargs--;
- /* Bounds should be removed from arg pack in case
- we handle not instrumented call in instrumented
- function. */
- nargs_to_copy = nargs;
- if (gimple_call_with_bounds_p (id->call_stmt)
- && !gimple_call_with_bounds_p (stmt))
- {
- for (i = gimple_call_num_args (id->call_stmt) - nargs;
- i < gimple_call_num_args (id->call_stmt);
- i++)
- if (POINTER_BOUNDS_P (gimple_call_arg (id->call_stmt, i)))
- nargs_to_copy--;
- remove_bounds = true;
- }
-
/* Create the new array of arguments. */
- n = nargs_to_copy + gimple_call_num_args (call_stmt);
+ n = nargs + gimple_call_num_args (call_stmt);
argarray.create (n);
argarray.safe_grow_cleared (n);
@@ -1920,26 +1894,11 @@ copy_bb (copy_body_data *id, basic_block bb,
gimple_call_arg_ptr (call_stmt, 0),
gimple_call_num_args (call_stmt) * sizeof (tree));
- if (remove_bounds)
- {
- /* Append the rest of arguments removing bounds. */
- unsigned cur = gimple_call_num_args (call_stmt);
- i = gimple_call_num_args (id->call_stmt) - nargs;
- for (i = gimple_call_num_args (id->call_stmt) - nargs;
- i < gimple_call_num_args (id->call_stmt);
- i++)
- if (!POINTER_BOUNDS_P (gimple_call_arg (id->call_stmt, i)))
- argarray[cur++] = gimple_call_arg (id->call_stmt, i);
- gcc_assert (cur == n);
- }
- else
- {
- /* Append the arguments passed in '...' */
- memcpy (argarray.address () + gimple_call_num_args (call_stmt),
- gimple_call_arg_ptr (id->call_stmt, 0)
- + (gimple_call_num_args (id->call_stmt) - nargs),
- nargs * sizeof (tree));
- }
+ /* Append the arguments passed in '...' */
+ memcpy (argarray.address () + gimple_call_num_args (call_stmt),
+ gimple_call_arg_ptr (id->call_stmt, 0)
+ + (gimple_call_num_args (id->call_stmt) - nargs),
+ nargs * sizeof (tree));
new_call = gimple_build_call_vec (gimple_call_fn (call_stmt),
argarray);
@@ -1966,20 +1925,13 @@ copy_bb (copy_body_data *id, basic_block bb,
{
/* __builtin_va_arg_pack_len () should be replaced by
the number of anonymous arguments. */
- size_t nargs = gimple_call_num_args (id->call_stmt), i;
+ size_t nargs = gimple_call_num_args (id->call_stmt);
tree count, p;
gimple *new_stmt;
for (p = DECL_ARGUMENTS (id->src_fn); p; p = DECL_CHAIN (p))
nargs--;
- /* For instrumented calls we should ignore bounds. */
- for (i = gimple_call_num_args (id->call_stmt) - nargs;
- i < gimple_call_num_args (id->call_stmt);
- i++)
- if (POINTER_BOUNDS_P (gimple_call_arg (id->call_stmt, i)))
- nargs--;
-
count = build_int_cst (integer_type_node, nargs);
new_stmt = gimple_build_assign (gimple_call_lhs (stmt), count);
gsi_replace (&copy_gsi, new_stmt, false);
@@ -3308,14 +3260,12 @@ initialize_inlined_parameters (copy_body_data *id, gimple *stmt,
is set only for CALL_EXPR_RETURN_SLOT_OPT. MODIFY_DEST, if non-null,
was the LHS of the MODIFY_EXPR to which this call is the RHS.
- RETURN_BOUNDS holds a destination for returned bounds.
-
The return value is a (possibly null) value that holds the result
as seen by the caller. */
static tree
declare_return_variable (copy_body_data *id, tree return_slot, tree modify_dest,
- tree return_bounds, basic_block entry_bb)
+ basic_block entry_bb)
{
tree callee = id->src_fn;
tree result = DECL_RESULT (callee);
@@ -3494,20 +3444,6 @@ declare_return_variable (copy_body_data *id, tree return_slot, tree modify_dest,
/* Remember this so we can ignore it in remap_decls. */
id->retvar = var;
-
- /* If returned bounds are used, then make var for them. */
- if (return_bounds)
- {
- tree bndtemp = create_tmp_var (pointer_bounds_type_node, "retbnd");
- DECL_SEEN_IN_BIND_EXPR_P (bndtemp) = 1;
- TREE_NO_WARNING (bndtemp) = 1;
- declare_inline_vars (id->block, bndtemp);
-
- id->retbnd = bndtemp;
- insert_init_stmt (id, entry_bb,
- gimple_build_assign (bndtemp, chkp_get_zero_bounds_var ()));
- }
-
return use;
}
@@ -4368,7 +4304,6 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
hash_map<tree, tree> *st = NULL;
tree return_slot;
tree modify_dest;
- tree return_bounds = NULL;
struct cgraph_edge *cg_edge;
cgraph_inline_failed_t reason;
basic_block return_block;
@@ -4377,7 +4312,6 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
bool successfully_inlined = false;
bool purge_dead_abnormal_edges;
gcall *call_stmt;
- unsigned int i;
unsigned int prop_mask, src_properties;
struct function *dst_cfun;
tree simduid;
@@ -4658,24 +4592,6 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
{
modify_dest = gimple_call_lhs (stmt);
- /* Remember where to copy returned bounds. */
- if (gimple_call_with_bounds_p (stmt)
- && TREE_CODE (modify_dest) == SSA_NAME)
- {
- gcall *retbnd = chkp_retbnd_call_by_val (modify_dest);
- if (retbnd)
- {
- return_bounds = gimple_call_lhs (retbnd);
- /* If returned bounds are not used then just
- remove unused call. */
- if (!return_bounds)
- {
- gimple_stmt_iterator iter = gsi_for_stmt (retbnd);
- gsi_remove (&iter, true);
- }
- }
- }
-
/* The function which we are inlining might not return a value,
in which case we should issue a warning that the function
does not return a value. In that case the optimizers will
@@ -4706,8 +4622,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
}
/* Declare the return variable for the function. */
- use_retvar = declare_return_variable (id, return_slot, modify_dest,
- return_bounds, bb);
+ use_retvar = declare_return_variable (id, return_slot, modify_dest, bb);
/* Add local vars in this inlined callee to caller. */
add_local_variables (id->src_cfun, cfun, id);
@@ -4814,12 +4729,6 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
gimple_set_location (clobber_stmt, gimple_location (old_stmt));
gsi_insert_after (&stmt_gsi, clobber_stmt, GSI_SAME_STMT);
}
-
- /* Copy bounds if we copy structure with bounds. */
- if (chkp_function_instrumented_p (id->dst_fn)
- && !BOUNDED_P (use_retvar)
- && chkp_type_has_pointer (TREE_TYPE (use_retvar)))
- id->assign_stmts.safe_push (stmt);
}
else
{
@@ -4873,20 +4782,6 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
gsi_remove (&stmt_gsi, true);
}
- /* Put returned bounds into the correct place if required. */
- if (return_bounds)
- {
- gimple *old_stmt = SSA_NAME_DEF_STMT (return_bounds);
- gimple *new_stmt = gimple_build_assign (return_bounds, id->retbnd);
- gimple_stmt_iterator bnd_gsi = gsi_for_stmt (old_stmt);
- unlink_stmt_vdef (old_stmt);
- gsi_replace (&bnd_gsi, new_stmt, false);
- maybe_clean_or_replace_eh_stmt (old_stmt, new_stmt);
- cgraph_update_edges_for_call_stmt (old_stmt,
- gimple_call_fndecl (old_stmt),
- new_stmt);
- }
-
if (purge_dead_abnormal_edges)
{
gimple_purge_dead_eh_edges (return_block);
@@ -4903,9 +4798,6 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
TREE_USED (gimple_assign_rhs1 (stmt)) = 1;
}
- /* Copy bounds for all generated assigns that need it. */
- for (i = 0; i < id->assign_stmts.length (); i++)
- chkp_copy_bounds_for_assign (id->assign_stmts[i], cg_edge);
id->assign_stmts.release ();
/* Output the inlining info for this abstract function, since it has been