Hi,

After recent merge with trunk I found that new IPA pass ICF requires few 
modifications for instrumented code:
 - instrumentation thunk existence means we cannot merge function into another 
one and should generate thunk instead
 - thunk generation should set with_bounds flag for instrumented funnctions
 - when DECL_INITIAL is cleaned for symbol, need_bounds_init should also be 
reset


Merge also required some minor changes in other patches due to changes 
includes, etc.  Nothing important to repost.

With these changes I get clean bootstrap and make check on linux-x86_64.  Also 
have clean runs of instrumented (run in NOP mode) and not isntrumented SPEC2000 
and SPEC2006.

I also tried to bootstrap it for Darwin but unfortunately trunk fails to 
bootstrap there even with patches from PR63534 applied.  Error is the same for 
mpx branch.

Thanks,
Ilya
--
2014-10-28  Ilya Enkovich  <ilya.enkov...@intel.com>

        * cgraphunit.c (cgraph_node::expand_thunk): Set with_bounds flag
        for created call statement.
        * ipa-icf.c (sem_function::merge): Do not merge when instrumentation
        thunk still exists.
        (sem_variable::merge): Reset need_bounds_init flag.


diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index f203f6d..c29e9aa 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1585,6 +1585,7 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool 
force_gimple_thunk)
       call = gimple_build_call_vec (build_fold_addr_expr_loc (0, alias), 
vargs);
       callees->call_stmt = call;
       gimple_call_set_from_thunk (call, true);
+      gimple_call_set_with_bounds (call, instrumentation_clone);
       if (restmp)
        {
           gimple_call_set_lhs (call, restmp);
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index e8c32c7..0ccda45 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -562,7 +562,8 @@ sem_function::merge (sem_item *alias_item)
       redirect_callers
        = (!original_discardable
           && alias->get_availability () > AVAIL_INTERPOSABLE
-          && original->get_availability () > AVAIL_INTERPOSABLE);
+          && original->get_availability () > AVAIL_INTERPOSABLE
+          && !alias->instrumented_version);
     }
   else
     {
@@ -1177,6 +1178,7 @@ sem_variable::merge (sem_item *alias_item)
       alias->analyzed = false;
 
       DECL_INITIAL (alias->decl) = NULL;
+      alias->need_bounds_init = false;
       alias->remove_all_references ();
 
       varpool_node::create_alias (alias_var->decl, decl);

Reply via email to