Message ID | 20140530125631.GA45878@msticlxl57.ims.intel.com |
---|---|
State | New |
Headers | show |
On 05/30/14 06:56, Ilya Enkovich wrote: > Hi, > > Before any instrumentation happens, instrumentation clones do not actually have any uses and thus may be removed. This patch fixes it by forbiding removal of not instrumented instrumentation clones. > > Bootstrapped and tested on linux-x86_64. > > Thanks, > Ilya > -- > gcc/ > > 2014-05-30 Ilya Enkovich <ilya.enkovich@intel.com> > > * cgraph.c (cgraph_can_remove_if_no_direct_calls_and_refs_p): Keep > all not instrumented instrumentation clones alive. OK for the trunk when the rest of the bounds checker stuff is approved. jeff
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 6210c68..1f684c2 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -2425,6 +2425,12 @@ bool cgraph_can_remove_if_no_direct_calls_and_refs_p (struct cgraph_node *node) { gcc_assert (!node->global.inlined_to); + /* Instrumentation clones should not be removed before + instrumentation happens. New callers may appear after + instrumentation. */ + if (node->instrumentation_clone + && !chkp_function_instrumented_p (node->decl)) + return false; /* Extern inlines can always go, we will use the external definition. */ if (DECL_EXTERNAL (node->decl)) return true;