Skip to content

Commit

Permalink
Prune any e-class with at least one leaf e-node
Browse files Browse the repository at this point in the history
  • Loading branch information
paulzzy committed Dec 25, 2024
1 parent bd67a26 commit c9389bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion egg-herbie/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ pub unsafe extern "C" fn egraph_run(
// E.g. if an e-class represents the number 2, it's safe to keep the `(2)` e-node but remove the
// `(+ 1 1)` e-node.
context.runner.egraph.classes_mut().for_each(|eclass| {
if eclass.data.is_some() {
if eclass.nodes.iter().any(|n| n.is_leaf()) {
eclass.nodes.retain(|n| n.is_leaf());
}
});
Expand Down

0 comments on commit c9389bd

Please sign in to comment.