Skip to content

Follow-up PR#829 (comballoc fixes for locals) #830

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

Merged
Merged
Show file tree
Hide file tree
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
12 changes: 11 additions & 1 deletion backend/comballoc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
(* special exception on linking described in the file LICENSE. *)
(* *)
(**************************************************************************)
[@@@ocaml.warning "+a-30-40-41-42"]

(* Combine heap allocations occurring in the same basic block *)

Expand Down Expand Up @@ -84,7 +85,16 @@ let rec combine i allocstate =
let newnext, s' = combine i.next allocstate in
(instr_cons_debug i.desc i.arg i.res i.dbg newnext, s')
end
| Iop _ ->
| Iop((Imove|Ispill|Ireload|Inegf|Iabsf|Iaddf|Isubf|Imulf|Idivf|Ifloatofint|
Iintoffloat|Iopaque|Iconst_int _|Iconst_float _|
Iconst_symbol _|Istackoffset _|Iload (_, _, _)|Istore (_, _, _)|Icompf _|
Ispecific _|Iname_for_debugger _|Iprobe_is_enabled _))
| Iop(Iintop(Iadd | Isub | Imul | Idiv | Imod | Iand | Ior | Ixor
| Ilsl | Ilsr | Iasr | Ipopcnt | Imulh _
| Iclz _ | Ictz _ | Icomp _))
| Iop(Iintop_imm((Iadd | Isub | Imul | Idiv | Imod | Iand | Ior | Ixor
| Ilsl | Ilsr | Iasr | Ipopcnt | Imulh _
| Iclz _ | Ictz _ | Icomp _),_)) ->
let (newnext, s') = combine i.next allocstate in
(instr_cons_debug i.desc i.arg i.res i.dbg newnext, s')
| Iifthenelse(test, ifso, ifnot) ->
Expand Down
9 changes: 9 additions & 0 deletions ocaml/asmcomp/comballoc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ let rec combine i allocstate =
let newnext = combine_restart i.next in
(instr_cons_debug i.desc i.arg i.res i.dbg newnext,
allocstate)
| Iop(Ibeginregion|Iendregion) -> begin
match allocstate with
| Pending_alloc { mode = Alloc_local; _ } ->
let newnext = combine_restart i.next in
(instr_cons_debug i.desc i.arg i.res i.dbg newnext, allocstate)
| No_alloc | Pending_alloc { mode = Alloc_heap; _ } ->
let newnext, s' = combine i.next allocstate in
(instr_cons_debug i.desc i.arg i.res i.dbg newnext, s')
end
| Iop _ ->
let (newnext, s') = combine i.next allocstate in
(instr_cons_debug i.desc i.arg i.res i.dbg newnext, s')
Expand Down