summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWojciech Meyer <wojciech.meyer@gmail.com>2011-12-22 19:11:29 +0000
committerWojciech Meyer <wojciech.meyer@gmail.com>2011-12-22 19:11:29 +0000
commit4f0bc4465fd9e0c883a889b3fbd6330c4d20e83c (patch)
tree77704fe787c1055a2418b9490f1344d2a42809a0
parentb47d5b20f27642acfcc92b18084710a130493b32 (diff)
Fix PR#5313: Run the rest of the ocamlopt optimisations even when -g flag is specifed
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--bytecomp/simplif.ml6
1 files changed, 4 insertions, 2 deletions
diff --git a/bytecomp/simplif.ml b/bytecomp/simplif.ml
index e26524e67..d5f85fc3a 100644
--- a/bytecomp/simplif.ml
+++ b/bytecomp/simplif.ml
@@ -260,6 +260,9 @@ let simplify_exits lam =
let simplify_lets lam =
+ (* Disable optimisations for bytecode compilation with -g flag *)
+ let optimize = !Clflags.native_code || not !Clflags.debug in
+
(* First pass: count the occurrences of all let-bound identifiers *)
let occ = (Hashtbl.create 83: (Ident.t, int ref) Hashtbl.t) in
@@ -307,7 +310,7 @@ let simplify_lets lam =
count bv l1; List.iter (count bv) ll
| Lfunction(kind, params, l) ->
count Tbl.empty l
- | Llet(str, v, Lvar w, l2) when not !Clflags.debug ->
+ | Llet(str, v, Lvar w, l2) when optimize ->
(* v will be replaced by w in l2, so each occurrence of v in l2
increases w's refcount *)
count (bind_var bv v) l2;
@@ -361,7 +364,6 @@ let simplify_lets lam =
and substitute the bindings of variables used exactly once. *)
let subst = Hashtbl.create 83 in
- let optimize = !Clflags.native_code || not !Clflags.debug in
(* This (small) optimisation is always legal, it may uncover some
tail call later on. *)