Skip to content

Commit

Permalink
fix bug in state edge passthrough aw yeah
Browse files Browse the repository at this point in the history
  • Loading branch information
oflatt committed Nov 11, 2024
1 parent 4982899 commit a915405
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
12 changes: 9 additions & 3 deletions dag_in_context/src/greedy_dag_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -858,13 +858,19 @@ pub fn extract_with_paths(
let root_costset_index = *extractor
.costs
.get(&root_eclass)
.expect("Failed to extract program! Also failed to extract any functions in program.")
.expect(&format!("Failed to extract function {}!", func))
.get(&root_eclass)
.unwrap_or_else(|| {
if effectful_paths.is_some() {
panic!("Failed to extract program after linear path is found!");
panic!(
"Failed to extract function {} after linear path is found!",
func
);
} else {
panic!("Failed to extract program during initial extraction!");
panic!(
"Failed to extract function {} during initial extraction!",
func
);
}
});
let root_costset = extractor.costsets[root_costset_index].clone();
Expand Down
2 changes: 1 addition & 1 deletion dag_in_context/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ pub fn optimize(

// if we are inlining, save the program
// TODO we inline on the first pass, but this should be configurable from the schedule
let inline_program = if i == 0 { Some(res.clone()) } else { None };
let inline_program = if i == 100000 { Some(res.clone()) } else { None };

for func in fns {
log::info!("Running pass {} on {}", i, func);
Expand Down
12 changes: 7 additions & 5 deletions dag_in_context/src/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub(crate) fn helpers() -> String {
(saturate type-helpers)
(saturate error-checking)
state-edge-passthrough
;state-edge-passthrough
(saturate
(saturate type-helpers)
Expand All @@ -26,11 +26,13 @@ pub(crate) fn helpers() -> String {
apply-subst-unions
cleanup-subst
subsume-after-helpers
(saturate boundary-analysis)
)"
.to_string()
)
;; be careful to finish dropping and substituting before subsuming things!
;; otherwise substitution or dropat may not finish, violating the weak linearity invariant
subsume-after-helpers"
.to_string()
}

fn cheap_optimizations() -> Vec<String> {
Expand Down

0 comments on commit a915405

Please sign in to comment.