From da2cf7557ad1b74556df070c76d16094b9f20256 Mon Sep 17 00:00:00 2001
From: Russel Arbore <russel.jma@gmail.com>
Date: Fri, 28 Feb 2025 14:45:40 -0600
Subject: [PATCH] gcm moment to allow reduce-slf in CPU code without worry

---
 hercules_opt/src/gcm.rs               | 7 +++++++
 juno_samples/rodinia/srad/src/cpu.sch | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/hercules_opt/src/gcm.rs b/hercules_opt/src/gcm.rs
index 1dcedd97..2579e73e 100644
--- a/hercules_opt/src/gcm.rs
+++ b/hercules_opt/src/gcm.rs
@@ -883,6 +883,13 @@ fn spill_clones(
                         init == *b
                             && editor.func().schedules[a.idx()].contains(&Schedule::ParallelReduce)
                     })
+                    .unwrap_or(false)
+                && !editor.func().nodes[a.idx()]
+                    .try_phi()
+                    .map(|(_, data)| {
+                        data.contains(b)
+                            && editor.func().schedules[a.idx()].contains(&Schedule::ParallelReduce)
+                    })
                     .unwrap_or(false))
     });
 
diff --git a/juno_samples/rodinia/srad/src/cpu.sch b/juno_samples/rodinia/srad/src/cpu.sch
index 2b45e8c9..a4cd4956 100644
--- a/juno_samples/rodinia/srad/src/cpu.sch
+++ b/juno_samples/rodinia/srad/src/cpu.sch
@@ -29,6 +29,8 @@ fixpoint {
 }
 simpl!(*);
 fork-interchange[0, 1](loop1);
+reduce-slf(*);
+simpl!(*);
 
 fork-split(*);
 unforkify(*);
-- 
GitLab