From 0792170806a1dcedb0347c239f9489b9704923aa Mon Sep 17 00:00:00 2001 From: Xavier Routh <xrouth2@illinois.edu> Date: Tue, 18 Feb 2025 11:34:17 -0600 Subject: [PATCH] loop canon bound fix --- hercules_opt/src/loop_bound_canon.rs | 24 ++++++++++++++---------- juno_samples/cava/src/cpu.sch | 1 + juno_samples/fork_join_tests/src/cpu.sch | 9 ++------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/hercules_opt/src/loop_bound_canon.rs b/hercules_opt/src/loop_bound_canon.rs index 3c6dc7ae..e305e9db 100644 --- a/hercules_opt/src/loop_bound_canon.rs +++ b/hercules_opt/src/loop_bound_canon.rs @@ -270,17 +270,20 @@ pub fn canonicalize_single_loop_bounds( edit.replace_all_uses_where(bound_id, new_condition, |usee| *usee == binop_node)?; } - // Add back to uses of the IV - for user in update_expr_users { - let new_user = Node::Binary { - left: user, - right: *initializer, - op: BinaryOperator::Add, - }; - let new_user = edit.add_node(new_user); - edit = edit.replace_all_uses(user, new_user)?; - } + // for user in update_expr_users { + // let new_user = Node::Binary { + // left: user, + // right: *initializer, + // op: BinaryOperator::Add, + // }; + // let new_user = edit.add_node(new_user); + // edit = edit.replace_all_uses(user, new_user)?; + // } + + // for + + // Add the offset back to users of the IV update expression let new_user = Node::Binary { left: *update_expression, right: *initializer, @@ -294,6 +297,7 @@ pub fn canonicalize_single_loop_bounds( && *usee != condition_node })?; + // Add the offset back to users of the IV directly let new_user = Node::Binary { left: *iv_phi, right: *initializer, diff --git a/juno_samples/cava/src/cpu.sch b/juno_samples/cava/src/cpu.sch index 1b595b05..4013fd27 100644 --- a/juno_samples/cava/src/cpu.sch +++ b/juno_samples/cava/src/cpu.sch @@ -38,6 +38,7 @@ fixpoint { } simpl!(fuse1); array-slf(fuse1); +loop-bound-canon(fuse1); inline(fuse2); no-memset(fuse2@res); diff --git a/juno_samples/fork_join_tests/src/cpu.sch b/juno_samples/fork_join_tests/src/cpu.sch index ad226a7a..c71aec11 100644 --- a/juno_samples/fork_join_tests/src/cpu.sch +++ b/juno_samples/fork_join_tests/src/cpu.sch @@ -25,11 +25,8 @@ gvn(*); phi-elim(*); dce(*); -xdot[true](auto.test2); -lift-dc-math(auto.test2); -xdot[true](auto.test2); -loop-bound-canon(auto.test2); -xdot[true](auto.test2); +lift-dc-math(*); +loop-bound-canon(*); fixpoint panic after 20 { forkify(*); @@ -38,8 +35,6 @@ fixpoint panic after 20 { dce(*); } -xdot[true](auto.test2); - dce(*); gvn(*); -- GitLab