From 2409857d60b8b905757014daeee884310e8bec69 Mon Sep 17 00:00:00 2001 From: Russel Arbore <russel.jma@gmail.com> Date: Thu, 31 Oct 2024 16:11:27 -0500 Subject: [PATCH] fix least_common_ancestor --- hercules_ir/src/dom.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hercules_ir/src/dom.rs b/hercules_ir/src/dom.rs index 7c4bb8a2..9708e3b2 100644 --- a/hercules_ir/src/dom.rs +++ b/hercules_ir/src/dom.rs @@ -82,10 +82,10 @@ impl DomTree { * ancestor of the two nodes that is as far down the tree as possible. */ pub fn least_common_ancestor(&self, mut a: NodeID, mut b: NodeID) -> NodeID { - while self.idom[&a].0 < self.idom[&b].0 { + while self.idom[&a].0 > self.idom[&b].0 { a = self.idom[&a].1; } - while self.idom[&a].0 > self.idom[&b].0 { + while self.idom[&a].0 < self.idom[&b].0 { b = self.idom[&b].1; } while a != b { -- GitLab