On 01/30/2017 04:12 PM, Richard Biener wrote: > On Mon, Jan 30, 2017 at 4:09 PM, Martin Liška <mli...@suse.cz> wrote: >> Hello. >> >> During investigation of another issue, I accidentally came a profile >> inconsistency >> mentioned in the PR. Problem is that flag_ipa_bit_cp is enabled in use stage >> of PGO >> and not in instrumentation stage. That causes ccp1 to find nonzero bits and >> that leads >> to a CFG changes as a condition can be folded away. >> >> Solution is to enable the same flag in generate phase. However I've got one >> more question: >> In -fprofile-generate we have 2 more functions available in symtab: >> >> _GLOBAL__sub_I_00100_0_c () >> { >> <bb 2> [0.00%]: >> __gcov_init (&*.LPBX0); >> return; >> >> } >> >> _GLOBAL__sub_D_00100_1_c () >> { >> <bb 2> [0.00%]: >> __gcov_exit (); >> return; >> >> } >> >> I'm wondering whether it can potentially influence early inlining decision? > > I guess yes...
Looks it should be fine as einline runs before IPA passes, where we create calls to __gcov_init and __gcov_exit. Thus the original functions do no see the global {cd}tor. #0 build_init_ctor (gcov_info_type=0x7ffff6a1a000) at ../../gcc/coverage.c:1045 #1 0x0000000000a1086d in coverage_obj_init () at ../../gcc/coverage.c:1144 #2 0x0000000000a10df7 in coverage_finish () at ../../gcc/coverage.c:1272 #3 0x00000000009ff53a in ipa_passes () at ../../gcc/cgraphunit.c:2338 #4 symbol_table::compile (this=this@entry=0x7ffff688a100) at ../../gcc/cgraphunit.c:2460 #5 0x0000000000a018b5 in symbol_table::compile (this=0x7ffff688a100) at ../../gcc/cgraphunit.c:2593 #6 symbol_table::finalize_compilation_unit (this=0x7ffff688a100) at ../../gcc/cgraphunit.c:2619 #7 0x0000000000dfc5fa in compile_file () at ../../gcc/toplev.c:488 #8 0x0000000000685d37 in do_compile () at ../../gcc/toplev.c:1983 #9 toplev::main (this=this@entry=0x7fffffffd8e0, argc=<optimized out>, argc@entry=21, argv=<optimized out>, argv@entry=0x7fffffffd9e8) at ../../gcc/toplev.c:2117 #10 0x0000000000688067 in main (argc=21, argv=0x7fffffffd9e8) at ../../gcc/main.c:39 Martin > >> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. >> >> Ready to be installed? > > Ok. > > Thanks, > Richard. > >> Martin