From f4b66ff05ab0affb47ebf390502cba5c277caea3 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Tue, 7 Dec 2021 17:39:27 +0100 Subject: Enforce evaluation order in IRC.add_interf and IRC.add_pref As written previously, OCaml can evaluate `nodeOfVar g v1` and `nodeOfVar g v2` in any order. Consequently, `v1` and `v2` can be entered in the `varTable` hash table in different order. This can result in different (but equally valid) register allocations. It's better to enforce one evaluation order for the sake of reproducible compilations when the OCaml version changes. --- backend/IRC.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'backend') diff --git a/backend/IRC.ml b/backend/IRC.ml index 6f4bbe29..1246a2d0 100644 --- a/backend/IRC.ml +++ b/backend/IRC.ml @@ -911,10 +911,10 @@ let location_of_var g v = (* The exported interface *) let add_interf g v1 v2 = - addEdge g (nodeOfVar g v1) (nodeOfVar g v2) + let n1 = nodeOfVar g v1 in let n2 = nodeOfVar g v2 in addEdge g n1 n2 let add_pref g v1 v2 = - addMovePref g (nodeOfVar g v1) (nodeOfVar g v2) + let n1 = nodeOfVar g v1 in let n2 = nodeOfVar g v2 in addMovePref g n1 n2 let coloring g = initialNodePartition g; -- cgit