Skip to content

Commit 4240b3f

Browse files
authored
Unrevert #1131 and fix a Cmm unboxing bug (#1284)
* Revert "Revert "Make Selectgen treat region boundaries more precisely" (#1283)" This reverts commit abd91a9. * Fix bad interaction between Cmm unboxing and locals Local regions should not count as "tail" for Cmm unboxing purposes.
1 parent abd91a9 commit 4240b3f

File tree

13 files changed

+485
-320
lines changed

13 files changed

+485
-320
lines changed

backend/cmm.ml

+6-10
Original file line numberDiff line numberDiff line change
@@ -319,14 +319,10 @@ let iter_shallow_tail f = function
319319
f e1;
320320
f e2;
321321
true
322-
| Cregion e ->
323-
f e;
324-
true
325-
| Ctail e ->
326-
f e;
327-
true
328322
| Cexit _ | Cop (Craise _, _, _) ->
329323
true
324+
| Cregion _
325+
| Ctail _
330326
| Cconst_int _
331327
| Cconst_natint _
332328
| Cconst_float _
@@ -365,12 +361,10 @@ let map_shallow_tail ?kind f = function
365361
| Ctrywith(e1, kind', id, e2, dbg, kind_before) ->
366362
Ctrywith(f e1, kind', id, f e2, dbg,
367363
Option.value kind ~default:kind_before)
368-
| Cregion e ->
369-
Cregion(f e)
370-
| Ctail e ->
371-
Ctail(f e)
372364
| Cexit _ | Cop (Craise _, _, _) as cmm ->
373365
cmm
366+
| Cregion _
367+
| Ctail _
374368
| Cconst_int _
375369
| Cconst_natint _
376370
| Cconst_float _
@@ -382,6 +376,8 @@ let map_shallow_tail ?kind f = function
382376

383377
let map_tail ?kind f =
384378
let rec loop = function
379+
| Cregion _
380+
| Ctail _
385381
| Cconst_int _
386382
| Cconst_natint _
387383
| Cconst_float _

backend/cmmgen.ml

+2-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,8 @@ let rec is_unboxed_number_cmm = function
394394
No_unboxing
395395
end
396396
| Cexit _ | Cop (Craise _, _, _) -> No_result
397-
| Csequence (_, a) | Cregion a | Ctail a
397+
| Cregion _ | Ctail _ -> No_unboxing
398+
| Csequence (_, a)
398399
| Clet (_, _, a) | Cphantom_let (_, _, a) | Clet_mut (_, _, _, a) ->
399400
is_unboxed_number_cmm a
400401
| Cconst_int _

0 commit comments

Comments
 (0)