From 0c78240fd7d519fc27ca822f66a92f85edf43f70 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 24 Aug 2023 15:10:46 +0200 Subject: Check that passes do not forget to define profile This patch extends verifier to check that all probabilities and counts are initialized if profile is supposed to be present. This is a bit complicated by the posibility that we inline !flag_guess_branch_probability function into function with profile defined and in this case we need to stop verification. For this reason I added flag to cfg structure tracking this. Bootstrapped/regtested x86_64-linux, comitted. gcc/ChangeLog: * cfg.h (struct control_flow_graph): New field full_profile. * auto-profile.cc (afdo_annotate_cfg): Set full_profile to true. * cfg.cc (init_flow): Set full_profile to false. * graphite.cc (graphite_transform_loops): Set full_profile to false. * lto-streamer-in.cc (input_cfg): Initialize full_profile flag. * predict.cc (pass_profile::execute): Set full_profile to true. * symtab-thunks.cc (expand_thunk): Set full_profile to true. * tree-cfg.cc (gimple_verify_flow_info): Verify that profile is full if full_profile is set. * tree-inline.cc (initialize_cfun): Initialize full_profile. (expand_call_inline): Combine full_profile. --- gcc/cfg.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/cfg.h') diff --git a/gcc/cfg.h b/gcc/cfg.h index a0e9449..4c1948b 100644 --- a/gcc/cfg.h +++ b/gcc/cfg.h @@ -78,6 +78,9 @@ struct GTY(()) control_flow_graph { /* Dynamically allocated edge/bb flags. */ int edge_flags_allocated; int bb_flags_allocated; + + /* Set if the profile is computed on every edge and basic block. */ + bool full_profile; }; -- cgit v1.1