From 7dfbb9f1f4066f714b662cad3d86ca19dd87e07f Mon Sep 17 00:00:00 2001 From: Russel Arbore <russel.jma@gmail.com> Date: Thu, 27 Feb 2025 20:15:34 -0600 Subject: [PATCH] whoops --- hercules_opt/src/pred.rs | 12 ++++++++++-- juno_samples/rodinia/bfs/src/bfs.jn | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/hercules_opt/src/pred.rs b/hercules_opt/src/pred.rs index 587c4507..8f1d0745 100644 --- a/hercules_opt/src/pred.rs +++ b/hercules_opt/src/pred.rs @@ -152,9 +152,13 @@ pub fn predication(editor: &mut FunctionEditor, typing: &Vec<TypeID>) { && editor.get_constant(cons).is_false() { editor.edit(|mut edit| { + let inv = edit.add_node(Node::Unary { + op: UnaryOperator::Not, + input: first, + }); let node = edit.add_node(Node::Binary { op: BinaryOperator::And, - left: first, + left: inv, right: third, }); edit = edit.replace_all_uses(id, node)?; @@ -188,9 +192,13 @@ pub fn predication(editor: &mut FunctionEditor, typing: &Vec<TypeID>) { && editor.get_constant(cons).is_true() { editor.edit(|mut edit| { + let inv = edit.add_node(Node::Unary { + op: UnaryOperator::Not, + input: first, + }); let node = edit.add_node(Node::Binary { op: BinaryOperator::Or, - left: first, + left: inv, right: second, }); edit = edit.replace_all_uses(id, node)?; diff --git a/juno_samples/rodinia/bfs/src/bfs.jn b/juno_samples/rodinia/bfs/src/bfs.jn index ca0f7774..2534a89c 100644 --- a/juno_samples/rodinia/bfs/src/bfs.jn +++ b/juno_samples/rodinia/bfs/src/bfs.jn @@ -43,7 +43,7 @@ fn bfs<n, m: usize>(graph_nodes: Node[n], source: u32, edges: u32[m]) -> i32[n] } @loop2 for i in 0..n { - stop = stop && updated[i]; + stop = stop && !updated[i]; if updated[i] { mask[i] = true; visited[i] = true; -- GitLab