aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.cc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2023-08-24 15:10:46 +0200
committerJan Hubicka <jh@suse.cz>2023-08-24 15:10:46 +0200
commit0c78240fd7d519fc27ca822f66a92f85edf43f70 (patch)
tree273eeb0cf60590b12f8d1d7efbcf7e1d9c4676f3 /gcc/tree-inline.cc
parent7564fe98657ad5ede34bd08f5279778fa8698865 (diff)
downloadgcc-0c78240fd7d519fc27ca822f66a92f85edf43f70.zip
gcc-0c78240fd7d519fc27ca822f66a92f85edf43f70.tar.gz
gcc-0c78240fd7d519fc27ca822f66a92f85edf43f70.tar.bz2
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.
Diffstat (limited to 'gcc/tree-inline.cc')
-rw-r--r--gcc/tree-inline.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc
index 954b39a..1d98d96 100644
--- a/gcc/tree-inline.cc
+++ b/gcc/tree-inline.cc
@@ -2815,6 +2815,7 @@ initialize_cfun (tree new_fndecl, tree callee_fndecl, profile_count count)
init_empty_tree_cfg ();
profile_status_for_fn (cfun) = profile_status_for_fn (src_cfun);
+ cfun->cfg->full_profile = src_cfun->cfg->full_profile;
profile_count num = count;
profile_count den = ENTRY_BLOCK_PTR_FOR_FN (src_cfun)->count;
@@ -4953,6 +4954,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id,
id->src_cfun = DECL_STRUCT_FUNCTION (fn);
id->reset_location = DECL_IGNORED_P (fn);
id->call_stmt = call_stmt;
+ cfun->cfg->full_profile &= id->src_cfun->cfg->full_profile;
/* When inlining into an OpenMP SIMD-on-SIMT loop, arrange for new automatic
variables to be added to IFN_GOMP_SIMT_ENTER argument list. */