From 26530750c41d8be0cd51fc75306ed9800df4b78b Mon Sep 17 00:00:00 2001 From: Gabriel Kronberger Date: Tue, 10 Sep 2024 12:50:31 +0200 Subject: [PATCH] Only update eclass analysis if the new analysis != nothing --- src/EGraphs/egraph.jl | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/EGraphs/egraph.jl b/src/EGraphs/egraph.jl index 40b51259..93954eda 100644 --- a/src/EGraphs/egraph.jl +++ b/src/EGraphs/egraph.jl @@ -426,21 +426,22 @@ function process_unions!(g::EGraph{ExpressionType,AnalysisType})::Int where {Exp eclass = g.classes[eclass_id_key] node_data = make(g, node) - if !isnothing(eclass.data) - joined_data = join(eclass.data, node_data) - - if joined_data != eclass.data - g.classes[eclass_id_key] = EClass{AnalysisType}(eclass_id, eclass.nodes, eclass.parents, joined_data) - # eclass.data = joined_data + if !isnothing(node_data) + if !isnothing(eclass.data) + joined_data = join(eclass.data, node_data) + + if joined_data != eclass.data + g.classes[eclass_id_key] = EClass{AnalysisType}(eclass_id, eclass.nodes, eclass.parents, joined_data) + # eclass.data = joined_data + modify!(g, eclass) + append!(g.analysis_pending, eclass.parents) + end + else + g.classes[eclass_id_key] = EClass{AnalysisType}(eclass_id, eclass.nodes, eclass.parents, node_data) + # eclass.data = node_data modify!(g, eclass) - append!(g.analysis_pending, eclass.parents) end - else - g.classes[eclass_id_key] = EClass{AnalysisType}(eclass_id, eclass.nodes, eclass.parents, node_data) - # eclass.data = node_data - modify!(g, eclass) end - end end n_unions