Skip to content

Commit 406751c

Browse files
authored
Follow-up PR#829 (comballoc fixes for locals) (#830)
* Apply the fix from #829 to asmcomp * Turn warnings on in comballoc and make match exhaustive
1 parent a046845 commit 406751c

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

backend/comballoc.ml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
(* special exception on linking described in the file LICENSE. *)
1313
(* *)
1414
(**************************************************************************)
15+
[@@@ocaml.warning "+a-30-40-41-42"]
1516

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

@@ -84,7 +85,16 @@ let rec combine i allocstate =
8485
let newnext, s' = combine i.next allocstate in
8586
(instr_cons_debug i.desc i.arg i.res i.dbg newnext, s')
8687
end
87-
| Iop _ ->
88+
| Iop((Imove|Ispill|Ireload|Inegf|Iabsf|Iaddf|Isubf|Imulf|Idivf|Ifloatofint|
89+
Iintoffloat|Iopaque|Iconst_int _|Iconst_float _|
90+
Iconst_symbol _|Istackoffset _|Iload (_, _, _)|Istore (_, _, _)|Icompf _|
91+
Ispecific _|Iname_for_debugger _|Iprobe_is_enabled _))
92+
| Iop(Iintop(Iadd | Isub | Imul | Idiv | Imod | Iand | Ior | Ixor
93+
| Ilsl | Ilsr | Iasr | Ipopcnt | Imulh _
94+
| Iclz _ | Ictz _ | Icomp _))
95+
| Iop(Iintop_imm((Iadd | Isub | Imul | Idiv | Imod | Iand | Ior | Ixor
96+
| Ilsl | Ilsr | Iasr | Ipopcnt | Imulh _
97+
| Iclz _ | Ictz _ | Icomp _),_)) ->
8898
let (newnext, s') = combine i.next allocstate in
8999
(instr_cons_debug i.desc i.arg i.res i.dbg newnext, s')
90100
| Iifthenelse(test, ifso, ifnot) ->

ocaml/asmcomp/comballoc.ml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ let rec combine i allocstate =
7575
let newnext = combine_restart i.next in
7676
(instr_cons_debug i.desc i.arg i.res i.dbg newnext,
7777
allocstate)
78+
| Iop(Ibeginregion|Iendregion) -> begin
79+
match allocstate with
80+
| Pending_alloc { mode = Alloc_local; _ } ->
81+
let newnext = combine_restart i.next in
82+
(instr_cons_debug i.desc i.arg i.res i.dbg newnext, allocstate)
83+
| No_alloc | Pending_alloc { mode = Alloc_heap; _ } ->
84+
let newnext, s' = combine i.next allocstate in
85+
(instr_cons_debug i.desc i.arg i.res i.dbg newnext, s')
86+
end
7887
| Iop _ ->
7988
let (newnext, s') = combine i.next allocstate in
8089
(instr_cons_debug i.desc i.arg i.res i.dbg newnext, s')

0 commit comments

Comments
 (0)