From 8bb85530fbf5b6de1cb268004611c6f76fb5871e Mon Sep 17 00:00:00 2001 From: Gaƫtan Gilbert Date: Tue, 7 May 2019 15:09:26 +0200 Subject: Avoid trivial (u=u) constraints in AcyclicGraph.constraints_for Not sure how often this happens in practice but it seems it could. --- lib/acyclicGraph.ml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/acyclicGraph.ml b/lib/acyclicGraph.ml index 7d04c8f5a1..e1dcfcc6ce 100644 --- a/lib/acyclicGraph.ml +++ b/lib/acyclicGraph.ml @@ -721,7 +721,10 @@ module Make (Point:Point) = struct let rmap, csts = PSet.fold (fun u (rmap,csts) -> let arcu = repr g u in if PSet.mem arcu.canon kept then - PMap.add arcu.canon arcu.canon rmap, Constraint.add (u,Eq,arcu.canon) csts + let csts = if Point.equal u arcu.canon then csts + else Constraint.add (u,Eq,arcu.canon) csts + in + PMap.add arcu.canon arcu.canon rmap, csts else match PMap.find arcu.canon rmap with | v -> rmap, Constraint.add (u,Eq,v) csts -- cgit v1.2.3