removing needless data dependencies

This commit is contained in:
Jakub Doka 2024-11-23 17:23:33 +01:00
parent f353bd5882
commit 86ca959ea3
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143

View file

@ -19,7 +19,6 @@ use {
}, },
alloc::{string::String, vec::Vec}, alloc::{string::String, vec::Vec},
core::{ core::{
any::Any,
assert_matches::debug_assert_matches, assert_matches::debug_assert_matches,
cell::{Cell, RefCell}, cell::{Cell, RefCell},
fmt::{self, Debug, Display, Write}, fmt::{self, Debug, Display, Write},
@ -1878,7 +1877,21 @@ impl Nodes {
false false
} }
Kind::Join => 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<_>>(),
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, Kind::Load => self[user].inputs[2] != val,
_ => self[user].inputs[0] != val || self[user].inputs[1..].contains(&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<Sig> { fn compute_signature(&mut self, func: &mut ty::Func, pos: Pos, args: &[Expr]) -> Option<Sig> {
let Func { file, expr, sig, .. } = self.tys.ins.funcs[*func]; let Func { file, expr, sig, .. } = self.tys.ins.funcs[*func];
let fast = self.files[file.index()].clone(); let fast = &self.files[file.index()];
let &Expr::Closure { args: cargs, ret, .. } = expr.get(&fast) else { let &Expr::Closure { args: cargs, ret, .. } = expr.get(fast) else {
unreachable!(); unreachable!();
}; };