From ca9b2bf9b83dcf4baeb36c16994659a0276b6f02 Mon Sep 17 00:00:00 2001
From: Russel Arbore <russel.jma@gmail.com>
Date: Thu, 20 Feb 2025 21:07:14 -0600
Subject: [PATCH] Hm

---
 hercules_opt/src/outline.rs | 16 ++++++++++------
 juno_scheduler/src/pm.rs    |  1 +
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/hercules_opt/src/outline.rs b/hercules_opt/src/outline.rs
index c6693336..088e5775 100644
--- a/hercules_opt/src/outline.rs
+++ b/hercules_opt/src/outline.rs
@@ -25,6 +25,7 @@ pub fn outline(
     dom: &DomTree,
     mut partition: BTreeSet<NodeID>,
     to_be_function_id: FunctionID,
+    outline_scalar_constants: bool,
 ) -> Option<Function> {
     // Step 1: do a whole bunch of analysis on the partition.
     let nodes = &editor.func().nodes;
@@ -34,12 +35,14 @@ pub fn outline(
             .any(|id| nodes[id.idx()].is_start() || nodes[id.idx()].is_parameter() || nodes[id.idx()].is_return()),
         "PANIC: Can't outline a partition containing the start node, parameter nodes, or return nodes."
     );
-    for (idx, node) in nodes.into_iter().enumerate() {
-        if let Node::Constant { id } = node
-            && editor.get_constant(*id).is_scalar()
-        {
-            // Usually, you don't want to explicitly outline scalar constants.
-            partition.remove(&NodeID::new(idx));
+    if !outline_scalar_constants {
+        for (idx, node) in nodes.into_iter().enumerate() {
+            if let Node::Constant { id } = node
+                && editor.get_constant(*id).is_scalar()
+            {
+                // Usually, you don't want to explicitly outline scalar constants.
+                partition.remove(&NodeID::new(idx));
+            }
         }
     }
     let mut top_nodes = partition.iter().filter(|id| {
@@ -621,5 +624,6 @@ pub fn dumb_outline(
         dom,
         partition,
         to_be_function_id,
+        true,
     )
 }
diff --git a/juno_scheduler/src/pm.rs b/juno_scheduler/src/pm.rs
index 44b14257..675cfe1c 100644
--- a/juno_scheduler/src/pm.rs
+++ b/juno_scheduler/src/pm.rs
@@ -2160,6 +2160,7 @@ fn run_pass(
                 &doms[func.idx()],
                 nodes,
                 new_func_id,
+                false,
             );
             let Some(new_func) = new_func else {
                 return Err(SchedulerError::PassError {
-- 
GitLab