summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/Graph/Graph.cs12
1 files changed, 2 insertions, 10 deletions
diff --git a/Source/Graph/Graph.cs b/Source/Graph/Graph.cs
index 4d58cbe7..ac406bb6 100644
--- a/Source/Graph/Graph.cs
+++ b/Source/Graph/Graph.cs
@@ -330,17 +330,9 @@ namespace Microsoft.Boogie.GraphUtil {
public Node LeastCommonAncestor(Node n1, Node n2)
{
- var nums = new HashSet<int>();
int num1 = nodeToPostOrderNumber[n1], num2 = nodeToPostOrderNumber[n2];
-
- while (true)
- {
- if (!nums.Add(num1))
- return postOrderNumberToNode[num1].Val;
- if (!nums.Add(num2))
- return postOrderNumberToNode[num2].Val;
- num1 = doms[num1]; num2 = doms[num2];
- }
+ int lca = intersect(num1, num2, this.doms);
+ return postOrderNumberToNode[lca].Val;
}
}