#include "config.h"
#include "system.h"
#include "coretypes.h"
-#include "hash-set.h"
-#include "machmode.h"
-#include "vec.h"
-#include "double-int.h"
-#include "input.h"
#include "alias.h"
#include "symtab.h"
#include "options.h"
-#include "wide-int.h"
-#include "inchash.h"
#include "tree.h"
#include "fold-const.h"
#include "stor-layout.h"
#include "tm.h"
#include "hard-reg-set.h"
#include "function.h"
-#include "is-a.h"
+#include "calls.h"
#include "tree-ssa-alias.h"
#include "predict.h"
#include "basic-block.h"
#include "gimple.h"
-#include "ipa-ref.h"
#include "lto-streamer.h"
#include "cgraph.h"
#include "tree-chkp.h"
if (!arg_type)
return orig_type;
- type = copy_node (orig_type);
+ type = build_distinct_type_copy (orig_type);
TYPE_ARG_TYPES (type) = copy_list (TYPE_ARG_TYPES (type));
for (arg_type = TYPE_ARG_TYPES (type);
if (gimple_has_body_p (fndecl))
{
- /* If function will not be instrumented, then it's instrumented
- version is a thunk for the original. */
- if (!chkp_instrumentable_p (fndecl))
- {
- clone->remove_callees ();
- clone->remove_all_references ();
- clone->thunk.thunk_p = true;
- clone->thunk.add_pointer_bounds_args = true;
- clone->create_edge (node, NULL, 0, CGRAPH_FREQ_BASE);
- /* Thunk shouldn't be a cdtor. */
- DECL_STATIC_CONSTRUCTOR (clone->decl) = 0;
- DECL_STATIC_DESTRUCTOR (clone->decl) = 0;
- }
- else
- {
- tree_function_versioning (fndecl, new_decl, NULL, false,
- NULL, false, NULL, NULL);
- clone->lowered = true;
- }
+ gcc_assert (chkp_instrumentable_p (fndecl));
+ tree_function_versioning (fndecl, new_decl, NULL, false,
+ NULL, false, NULL, NULL);
+ clone->lowered = true;
}
/* New params are inserted after versioning because it
/* Clone all aliases. */
for (i = 0; node->iterate_direct_aliases (i, ref); i++)
- {
- struct cgraph_node *alias = dyn_cast <cgraph_node *> (ref->referring);
- struct cgraph_node *chkp_alias
- = chkp_maybe_create_clone (alias->decl);
- chkp_alias->create_reference (clone, IPA_REF_ALIAS, NULL);
- }
+ chkp_maybe_create_clone (ref->referring->decl);
/* Clone all thunks. */
for (e = node->callers; e; e = e->next_caller)
ref = node->ref_list.first_reference ();
if (ref)
- chkp_maybe_create_clone (ref->referred->decl);
+ {
+ target = chkp_maybe_create_clone (ref->referred->decl);
+ clone->create_reference (target, IPA_REF_ALIAS);
+ }
if (node->alias_target)
{