summaryrefslogtreecommitdiff
path: root/asmcomp/liveness.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2014-05-16 14:37:22 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2014-05-16 14:37:22 +0000
commit657ba73021599ec386f65d4e07ff2d7445d864f4 (patch)
tree21485fe3f74709e2bedbc870b8cc1e71405c6534 /asmcomp/liveness.ml
parent6d25df3c9bb2b5ea59463cd3832d4b06a02c6b68 (diff)
downloadocaml-657ba73021599ec386f65d4e07ff2d7445d864f4.tar.gz
Liveness & Deadcode: fix i386-specific issue with move instructions accessing
the x87 FP stack, which must not be eliminated. CSEgen: harden against the same x87-specific issue + against reuse of values in fixed hardware registers that were destroyed by a prior operation. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14877 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'asmcomp/liveness.ml')
-rw-r--r--asmcomp/liveness.ml6
1 files changed, 5 insertions, 1 deletions
diff --git a/asmcomp/liveness.ml b/asmcomp/liveness.ml
index c5b0c0a3a1..2ef322ef3e 100644
--- a/asmcomp/liveness.ml
+++ b/asmcomp/liveness.ml
@@ -41,7 +41,11 @@ let rec live i finally =
Reg.set_of_array i.arg
| Iop op ->
let after = live i.next finally in
- if Proc.op_is_pure op && Reg.disjoint_set_array after i.res then begin
+ if Proc.op_is_pure op (* no side effects *)
+ && Reg.disjoint_set_array after i.res (* results are not used after *)
+ && not (Proc.regs_are_volatile i.arg) (* no stack-like hard reg *)
+ && not (Proc.regs_are_volatile i.res) (* is involved *)
+ then begin
(* This operation is dead code. Ignore its arguments. *)
i.live <- after;
after