From 657ba73021599ec386f65d4e07ff2d7445d864f4 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Fri, 16 May 2014 14:37:22 +0000 Subject: 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 --- asmcomp/liveness.ml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'asmcomp/liveness.ml') 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 -- cgit v1.2.1