From eaf09eb1b58e1d159839aa0c4b474e7d62d5dd09 Mon Sep 17 00:00:00 2001
From: Russel Arbore <russel.jma@gmail.com>
Date: Fri, 28 Feb 2025 16:31:57 -0600
Subject: [PATCH] hmm

---
 hercules_opt/src/gcm.rs              | 4 ++--
 juno_samples/rodinia/bfs/src/gpu.sch | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hercules_opt/src/gcm.rs b/hercules_opt/src/gcm.rs
index 2579e73e..d950941a 100644
--- a/hercules_opt/src/gcm.rs
+++ b/hercules_opt/src/gcm.rs
@@ -879,8 +879,8 @@ fn spill_clones(
                     || editor.func().nodes[a.idx()].is_reduce())
                 && !editor.func().nodes[a.idx()]
                     .try_reduce()
-                    .map(|(_, init, _)| {
-                        init == *b
+                    .map(|(_, init, reduct)| {
+                        (init == *b || reduct == *b)
                             && editor.func().schedules[a.idx()].contains(&Schedule::ParallelReduce)
                     })
                     .unwrap_or(false)
diff --git a/juno_samples/rodinia/bfs/src/gpu.sch b/juno_samples/rodinia/bfs/src/gpu.sch
index 5be2d903..6c4d027b 100644
--- a/juno_samples/rodinia/bfs/src/gpu.sch
+++ b/juno_samples/rodinia/bfs/src/gpu.sch
@@ -27,6 +27,7 @@ simpl!(*);
 predication(*);
 simpl!(*);
 
+unforkify(cost_init);
 parallel-reduce(loop1);
 forkify(*);
 fork-guard-elim(*);
@@ -35,5 +36,4 @@ predication(*);
 reduce-slf(*);
 simpl!(*);
 
-unforkify(cost_init);
 gcm(*);
-- 
GitLab