diff --git a/hercules_opt/src/gcm.rs b/hercules_opt/src/gcm.rs index 446b31849b20fd3fa3d5361a74c15f0514d1dbad..f240589300520d680c1e126ba93728977f1d17e8 100644 --- a/hercules_opt/src/gcm.rs +++ b/hercules_opt/src/gcm.rs @@ -486,11 +486,10 @@ fn basic_blocks( // Look between the LCA and the schedule early location to place the // node. let schedule_early = schedule_early[id.idx()].unwrap(); + // If the node has no users, then it doesn't really matter where we + // place it - just place it at the early placement. let schedule_late = lca.unwrap_or(schedule_early); - let mut chain = dom - // If the node has no users, then it doesn't really matter where we - // place it - just place it at the early placement. - .chain(schedule_late, schedule_early); + let mut chain = dom.chain(schedule_late, schedule_early); if let Some(mut location) = chain.next() { while let Some(control_node) = chain.next() { diff --git a/hercules_opt/src/loop_bound_canon.rs b/hercules_opt/src/loop_bound_canon.rs index e305e9dbb4380a148493e21fcfe018f85553593c..c127c617b1b8e3d1b5cc58af87bb1db26e1b931a 100644 --- a/hercules_opt/src/loop_bound_canon.rs +++ b/hercules_opt/src/loop_bound_canon.rs @@ -47,8 +47,6 @@ pub fn canonicalize_single_loop_bounds( ) -> bool { let function = editor.func(); - println!("canonicalizing {:?}", l.header); - let Some(loop_condition) = get_loop_exit_conditions(function, l, control_subgraph) else { return false; }; @@ -66,7 +64,6 @@ pub fn canonicalize_single_loop_bounds( let ivs = compute_iv_ranges(editor, l, ivs, &loop_condition); if has_canonical_iv(editor, l, &ivs).is_some() { - // println!("has canon iv!"); return false; } @@ -78,7 +75,6 @@ pub fn canonicalize_single_loop_bounds( // Assume there is only one loop bound iv. if loop_bound_ivs.len() != 1 { - // println!("has multiple iv!"); return false; } @@ -225,25 +221,15 @@ pub fn canonicalize_single_loop_bounds( // If increment is negative (how in the world do we know that...) // Increment can be DefinetlyPostiive, Unknown, DefinetlyNegative. - // // First, massage loop condition to be <, because that is normal! - // Also includes - // editor.edit(|mut edit| { - - // } - // Collect immediate IV users - let update_expr_users: Vec<_> = editor .get_users(*update_expression) .filter(|node| *node != iv.phi() && *node != condition_node) .collect(); - // println!("update_expr_users: {:?}", update_expr_users); let iv_phi_users: Vec<_> = editor .get_users(iv.phi()) .filter(|node| *node != iv.phi() && *node != *update_expression) .collect(); - // println!(" iv_phi_users: {:?}", iv_phi_users); - let result = editor.edit(|mut edit| { // 4) Second, change loop IV to go from 0..N. // we subtract off init from init and dc_bound_node, @@ -270,7 +256,6 @@ pub fn canonicalize_single_loop_bounds( edit.replace_all_uses_where(bound_id, new_condition, |usee| *usee == binop_node)?; } - // for user in update_expr_users { // let new_user = Node::Binary { // left: user, @@ -281,7 +266,7 @@ pub fn canonicalize_single_loop_bounds( // edit = edit.replace_all_uses(user, new_user)?; // } - // for + // for // Add the offset back to users of the IV update expression let new_user = Node::Binary { @@ -311,6 +296,5 @@ pub fn canonicalize_single_loop_bounds( Ok(edit) }); - println!("result: {:?}", result); return result; } diff --git a/juno_samples/cava/src/cpu.sch b/juno_samples/cava/src/cpu.sch index 4013fd277051b425b116486be78a6555e920b2d7..6cd33a3b1054069264ba6406ba37f2b11031f095 100644 --- a/juno_samples/cava/src/cpu.sch +++ b/juno_samples/cava/src/cpu.sch @@ -39,6 +39,13 @@ fixpoint { simpl!(fuse1); array-slf(fuse1); loop-bound-canon(fuse1); +fixpoint { + forkify(fuse1); + fork-guard-elim(fuse1); + fork-coalesce(fuse1); +} +predication(fuse1); +simpl!(fuse1); inline(fuse2); no-memset(fuse2@res); @@ -117,7 +124,8 @@ simpl!(fuse5); delete-uncalled(*); simpl!(*); -simpl!(fuse1); + +fork-split(fuse1); unforkify(fuse1); fork-split(fuse2); unforkify(fuse2);