Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute presence of calls after possibly removing poll instruction (CFG selection) #3519

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions backend/cfg_selectgen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1160,14 +1160,15 @@ class virtual selector_generic =
in
self#emit_tail env f.Cmm.fun_body;
let body = self#extract in
let fun_contains_calls =
Sub_cfg.exists_basic_blocks body ~f:Cfg.basic_block_contains_calls
in
let cfg =
(* note: we set `fun_contains_calls` to `true` here, but will compute
its proper value below, after possibly removing the prologue poll
instruction. It is not very satisfactory, but as noted in the CR
below, we should revisit the way we handle polling points. *)
Cfg.create ~fun_name:f.Cmm.fun_name.sym_name ~fun_args:loc_arg
~fun_codegen_options:
(Cfg.of_cmm_codegen_option f.Cmm.fun_codegen_options)
~fun_dbg:f.Cmm.fun_dbg ~fun_contains_calls
~fun_dbg:f.Cmm.fun_dbg ~fun_contains_calls:true
~fun_num_stack_slots:(Array.make Proc.num_stack_slot_classes 0)
~fun_poll:f.Cmm.fun_poll
in
Expand Down Expand Up @@ -1222,6 +1223,10 @@ class virtual selector_generic =
`Cfg.register_predecessors_for_all_blocks`. *)
Cfgize_utils.Stack_offset_and_exn.update_cfg cfg;
Cfg.register_predecessors_for_all_blocks cfg;
let fun_contains_calls =
Sub_cfg.exists_basic_blocks body ~f:Cfg.basic_block_contains_calls
in
let cfg = { cfg with fun_contains_calls } in
let cfg_with_layout =
Cfg_with_layout.create cfg ~layout ~preserve_orig_labels:false
~new_labels:Label.Set.empty
Expand Down
Loading