From 8609f3f898e5dea73a07c46489b1e5db4d97f26e Mon Sep 17 00:00:00 2001 From: Xavier Routh <xrouth2@illinois.edu> Date: Sun, 2 Mar 2025 16:44:05 -0600 Subject: [PATCH] Loop bound lte --- hercules_opt/src/forkify.rs | 11 ++++++----- hercules_opt/src/loop_bound_canon.rs | 3 +-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hercules_opt/src/forkify.rs b/hercules_opt/src/forkify.rs index a6308d66..189670de 100644 --- a/hercules_opt/src/forkify.rs +++ b/hercules_opt/src/forkify.rs @@ -106,7 +106,7 @@ pub fn forkify_loop( else { return false; }; - + // Compute loop variance let loop_variance = compute_loop_variance(editor, l); let ivs = compute_induction_vars(editor.func(), l, &loop_variance); @@ -530,10 +530,11 @@ pub fn analyze_phis<'a>( let intersection: HashSet<_> = set1.intersection(&set2).cloned().collect(); // If this phi uses any other phis the node is loop dependant, - // we use `phis` because this phi can actually contain the loop iv and its fine. - if uses_for_dependance.any(|node| phis.contains(&node) && node != *phi) { - LoopPHI::LoopDependant(*phi) - } else if intersection.clone().iter().next().is_some() { + // // we use `phis` because this phi can actually contain the loop iv and its fine. + // if uses_for_dependance.any(|node| phis.contains(&node) && node != *phi) { + // LoopPHI::LoopDependant(*phi) + // } else + if intersection.clone().iter().next().is_some() { // PHIs on the frontier of the uses by the candidate phi, i.e in uses_for_dependance need // to have headers that postdominate the loop continue latch. The value of the PHI used needs to be defined // by the time the reduce is triggered (at the end of the loop's internal control). diff --git a/hercules_opt/src/loop_bound_canon.rs b/hercules_opt/src/loop_bound_canon.rs index f1ce872c..3e194e2d 100644 --- a/hercules_opt/src/loop_bound_canon.rs +++ b/hercules_opt/src/loop_bound_canon.rs @@ -275,7 +275,7 @@ pub fn canonicalize_single_loop_bounds( let new_binop_node = edit.add_node(Node::Binary { left, right: blah, op: BinaryOperator::LT }); edit = edit.replace_all_uses_where(binop_node, new_binop_node, |usee| *usee == if_node)?; - Some((init_id, bound_id, new_binop_node, if_node)) + Some((init_id, blah, new_binop_node, if_node)) } else {guard_info}; edit = edit.replace_all_uses_where(dc_bound_node, new_dc_bound_node, |usee| *usee == new_bop)?; @@ -289,7 +289,6 @@ pub fn canonicalize_single_loop_bounds( }; Ok(edit) }); - let update_expr_users: Vec<_> = editor .get_users(*update_expression) -- GitLab