From 86ca959ea3eae1cb32298e135a444820583d24a0 Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Sat, 23 Nov 2024 17:23:33 +0100 Subject: [PATCH] removing needless data dependencies --- lang/src/son.rs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/lang/src/son.rs b/lang/src/son.rs index a55328d3..a52d3802 100644 --- a/lang/src/son.rs +++ b/lang/src/son.rs @@ -19,7 +19,6 @@ use { }, alloc::{string::String, vec::Vec}, core::{ - any::Any, assert_matches::debug_assert_matches, cell::{Cell, RefCell}, fmt::{self, Debug, Display, Write}, @@ -1878,7 +1877,21 @@ impl Nodes { false } Kind::Join => false, - Kind::Stre => self[user].inputs[3] != val, + Kind::Stre => { + debug_assert_eq!( + self[user].inputs[4..] + .iter() + .filter(|&&v| self[v].kind != Kind::Load) + .copied() + .collect::>(), + vec![] + ); + debug_assert_matches!( + self[self[user].inputs[3]].kind, + Kind::Stre | Kind::Mem | Kind::Phi + ); + self[user].inputs.iter().position(|&v| v == val).is_some_and(|v| v < 3) + } Kind::Load => self[user].inputs[2] != val, _ => self[user].inputs[0] != val || self[user].inputs[1..].contains(&val), } @@ -4422,8 +4435,8 @@ impl<'a> Codegen<'a> { fn compute_signature(&mut self, func: &mut ty::Func, pos: Pos, args: &[Expr]) -> Option { let Func { file, expr, sig, .. } = self.tys.ins.funcs[*func]; - let fast = self.files[file.index()].clone(); - let &Expr::Closure { args: cargs, ret, .. } = expr.get(&fast) else { + let fast = &self.files[file.index()]; + let &Expr::Closure { args: cargs, ret, .. } = expr.get(fast) else { unreachable!(); };