https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79259
Bug ID: 79259 Summary: [7 Regression] Corrupted profile when one uses -O1 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org Target Milestone: --- Following test-case can't properly use PGO: gcc auto-profile.ii -fprofile-generate -O1 && ./a.out && gcc auto-profile.ii -fprofile-use -O1 auto-profile.ii:17:1: error: the control flow of function ‘_Z3fn2v’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch] } ^ auto-profile.ii:17:1: error: the control flow of function ‘_Z3fn2v’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch] cc1plus: some warnings being treated as errors Started with r239769. Problem is that flag_ipa_bit_cp is enabled with -fprofile-use. That triggers ccp1 to find nonzero bits as it's guarded with: if (ccp_finalize (nonzero_p || flag_ipa_bit_cp)) { todo = (TODO_cleanup_cfg | TODO_update_ssa); /* ccp_finalize does not preserve loop-closed ssa. */ loops_state_clear (LOOP_CLOSED_SSA); } I've got patch for that.