summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Bauereiss2020-04-12 20:47:06 +0100
committerThomas Bauereiss2020-04-21 14:02:39 +0100
commitce927d2003375e585fb814ac1f79d8c2dfac806c (patch)
treea2f777999800c66d849aa70883401baed799e8eb /src
parentba733dcb489ee6990bc0b5125cb5a99fc3e9b722 (diff)
Mono: Propagate constants after applying pattern choices
This will propagate constant assignments in chosen branches of case expressions after applying pattern choices, e.g. the assignment to datasize in match size { [bitone, _] => datasize = 64, ... } when pattern [bitone, _] is chosen for size.
Diffstat (limited to 'src')
-rw-r--r--src/monomorphise.ml6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/monomorphise.ml b/src/monomorphise.ml
index e49ef4f5..9086d488 100644
--- a/src/monomorphise.ml
+++ b/src/monomorphise.ml
@@ -1044,8 +1044,8 @@ let split_defs target all_errors splits env defs =
if check_split_size patsubsts (pat_loc p) then
List.map (fun (pat',substs,pchoices,ksubsts) ->
let exp' = Spec_analysis.nexp_subst_exp ksubsts e in
- let exp' = subst_exp ref_vars substs ksubsts exp' in
let exp' = apply_pat_choices pchoices exp' in
+ let exp' = subst_exp ref_vars substs ksubsts exp' in
let exp' = stop_at_false_assertions exp' in
Pat_aux (Pat_exp (pat', map_exp exp'),l))
patsubsts
@@ -1064,11 +1064,11 @@ let split_defs target all_errors splits env defs =
if check_split_size patsubsts (pat_loc p) then
List.map (fun (pat',substs,pchoices,ksubsts) ->
let exp1' = Spec_analysis.nexp_subst_exp ksubsts e1 in
- let exp1' = subst_exp ref_vars substs ksubsts exp1' in
let exp1' = apply_pat_choices pchoices exp1' in
+ let exp1' = subst_exp ref_vars substs ksubsts exp1' in
let exp2' = Spec_analysis.nexp_subst_exp ksubsts e2 in
- let exp2' = subst_exp ref_vars substs ksubsts exp2' in
let exp2' = apply_pat_choices pchoices exp2' in
+ let exp2' = subst_exp ref_vars substs ksubsts exp2' in
let exp2' = stop_at_false_assertions exp2' in
Pat_aux (Pat_when (pat', map_exp exp1', map_exp exp2'),l))
patsubsts