Skip to content

Commit 972b29d

Browse files
committed
fix up rountrip test
1 parent 9c88297 commit 972b29d

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

dag_in_context/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ fn has_debug_exprs(serialized_egraph: &egraph_serialize::EGraph) -> bool {
344344
/// Checks that the extracted program is the same as the input program.
345345
pub fn check_roundtrip_egraph(program: &TreeProgram) {
346346
let fns = program.fns();
347-
let schedule = format!("\n(run-schedule\n {})", schedule::helpers());
347+
let schedule = format!("\n(run-schedule\n {})", schedule::types_only());
348348
let egglog_prog = build_program(program, None, &fns, &schedule, None, true, false);
349349

350350
log::info!("Running egglog program...");

dag_in_context/src/schedule.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ pub(crate) fn types_and_indexing() -> String {
3030
.to_string()
3131
}
3232

33+
/// Like types_and_indexing but without always-run, so no SubTuple/canonicalization
34+
/// rewrites fire that would merge structurally-equivalent forms.
35+
/// Used by check_roundtrip_egraph to ensure the only program in the egraph
36+
/// is the original one.
37+
pub(crate) fn types_only() -> String {
38+
"
39+
(saturate
40+
(saturate type-helpers)
41+
type-analysis)"
42+
.to_string()
43+
}
44+
3345
// Unfortunately due to substition, helpers cannot be saturated.
3446
pub(crate) fn helpers() -> String {
3547
let types_and_indexing = types_and_indexing();
@@ -181,16 +193,20 @@ pub fn mk_sequential_schedule(config: &EggccConfig) -> Vec<CompilerPass> {
181193
"
182194
(run-schedule {helpers})"
183195
)));
184-
res.extend(optimizations(config.disable_hacker_rules).iter().map(|optimization| {
185-
CompilerPass::Schedule(format!(
186-
"
196+
res.extend(
197+
optimizations(config.disable_hacker_rules)
198+
.iter()
199+
.map(|optimization| {
200+
CompilerPass::Schedule(format!(
201+
"
187202
(run-schedule
188203
{helpers}
189204
{optimization}
190205
{helpers})
191206
"
192-
))
193-
}));
207+
))
208+
}),
209+
);
194210
res
195211
}
196212

0 commit comments

Comments
 (0)