diff --git a/hercules_opt/src/sroa.rs b/hercules_opt/src/sroa.rs
index ccc2605c5f3da9fd85eb4d596b54f504ddbea08f..efa7bd9040e594482eaf103de69aa230195930b8 100644
--- a/hercules_opt/src/sroa.rs
+++ b/hercules_opt/src/sroa.rs
@@ -342,6 +342,7 @@ pub fn sroa(editor: &mut FunctionEditor, reverse_postorder: &Vec<NodeID>, types:
                             },
                         );
                     });
+                    to_delete.push(node);
                 } else {
                     worklist.push_back(WorkItem::AllocatedPhi {
                         control,
@@ -426,8 +427,6 @@ pub fn sroa(editor: &mut FunctionEditor, reverse_postorder: &Vec<NodeID>, types:
 
     // Create new nodes nodes
     for (node_id, node) in to_insert {
-        assert!(node_id == editor.func().nodes.len());
-        println!("Inserting {:?} : {:?}", node_id, node);
         editor.edit(|mut edit| {
             let id = edit.add_node(node);
             assert!(node_id == id.idx());
diff --git a/juno_frontend/src/lib.rs b/juno_frontend/src/lib.rs
index e54e88fc13ee98373384e6641ed5ded76dd34b8e..59240fe9c9c1624a6989732b23c8c5e9a987fd79 100644
--- a/juno_frontend/src/lib.rs
+++ b/juno_frontend/src/lib.rs
@@ -151,14 +151,13 @@ pub fn compile_ir(
     if x_dot {
         pm.add_pass(hercules_opt::pass::Pass::Xdot(true));
     }
-    add_pass!(pm, verify, SROA);
-    if x_dot {
-        pm.add_pass(hercules_opt::pass::Pass::Xdot(true));
-    }
     add_pass!(pm, verify, Inline);
     // Run SROA pretty early (though after inlining which can make SROA more effective) so that
     // CCP, GVN, etc. can work on the result of SROA
     add_pass!(pm, verify, SROA);
+    // We run phi-elim again because SROA can introduce new phis that might be able to be
+    // simplified
+    add_verified_pass!(pm, verify, PhiElim);
     if x_dot {
         pm.add_pass(hercules_opt::pass::Pass::Xdot(true));
     }