From ee62df2ffbdee103f2c4f2389b974befec1fdb87 Mon Sep 17 00:00:00 2001 From: Alexander McCord Date: Sun, 2 Jun 2024 09:27:24 -0700 Subject: [PATCH] Make a note here. --- EqSat/include/Luau/EGraph.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/EqSat/include/Luau/EGraph.h b/EqSat/include/Luau/EGraph.h index 3a18a361..359d3d7f 100644 --- a/EqSat/include/Luau/EGraph.h +++ b/EqSat/include/Luau/EGraph.h @@ -123,6 +123,12 @@ private: void repair(EClass& eclass) { + // In the egg paper, the `repair` function makes use of two loops over the `eclass.parents` + // by first erasing the old enode entry, and adding back the canonicalized enode with the canonical id. + // And then in another loop that follows, deduplicate it. + // + // Here, we unify the two loops. I think it's equivalent? + // After canonicalizing the enodes, the eclass may contain multiple enodes that are equivalent. std::unordered_map map; for (auto& [enode, id] : eclass.parents)