[MLton-commit] r6844
Matthew Fluet
fluet at mlton.org
Mon Sep 8 18:24:30 PDT 2008
Avoid construction of duplicate edges in the graph to find (mutually)
recursive datatypes. Thanks to Nicolas Bertolotti for the patch.
----------------------------------------------------------------------
U mlton/trunk/mlton/ssa/ref-flatten.fun
----------------------------------------------------------------------
Modified: mlton/trunk/mlton/ssa/ref-flatten.fun
===================================================================
--- mlton/trunk/mlton/ssa/ref-flatten.fun 2008-09-08 13:55:24 UTC (rev 6843)
+++ mlton/trunk/mlton/ssa/ref-flatten.fun 2008-09-09 01:24:29 UTC (rev 6844)
@@ -774,8 +774,16 @@
case Type.dest t of
CPointer => ()
| Datatype tc =>
- (ignore o Graph.addEdge)
- (graph, {from = n, to = tyconNode tc})
+ let
+ val m = tyconNode tc
+ val e = {from = n, to = m}
+ in
+ (* Avoid redundant edges. *)
+ if Node.hasEdge e then ()
+ else
+ (ignore o Graph.addEdge)
+ (graph, {from = n, to = tyconNode tc})
+ end
| IntInf => ()
| Object {args, ...} =>
Prod.foreach (args, loop)
More information about the MLton-commit
mailing list