Skip to content

Commit d68aa22

Browse files
committed
liveness: Access live nodes directly through self.lnks[ln]
1 parent 57d3897 commit d68aa22

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

compiler/rustc_passes/src/liveness.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,6 @@ impl IrMaps<'tcx> {
302302
fn set_captures(&mut self, hir_id: HirId, cs: Vec<CaptureInfo>) {
303303
self.capture_info_map.insert(hir_id, Rc::new(cs));
304304
}
305-
306-
fn lnk(&self, ln: LiveNode) -> LiveNodeKind {
307-
self.lnks[ln]
308-
}
309305
}
310306

311307
fn visit_fn<'tcx>(
@@ -691,7 +687,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
691687
fn live_on_entry(&self, ln: LiveNode, var: Variable) -> Option<LiveNodeKind> {
692688
assert!(ln.is_valid());
693689
let reader = self.rwu_table.get_reader(self.idx(ln, var));
694-
if reader.is_valid() { Some(self.ir.lnk(reader)) } else { None }
690+
if reader.is_valid() { Some(self.ir.lnks[reader]) } else { None }
695691
}
696692

697693
// Is this variable live on entry to any of its successor nodes?
@@ -708,7 +704,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
708704
fn assigned_on_entry(&self, ln: LiveNode, var: Variable) -> Option<LiveNodeKind> {
709705
assert!(ln.is_valid());
710706
let writer = self.rwu_table.get_writer(self.idx(ln, var));
711-
if writer.is_valid() { Some(self.ir.lnk(writer)) } else { None }
707+
if writer.is_valid() { Some(self.ir.lnks[writer]) } else { None }
712708
}
713709

714710
fn assigned_on_exit(&self, ln: LiveNode, var: Variable) -> Option<LiveNodeKind> {
@@ -746,7 +742,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
746742
let mut wr = Vec::new();
747743
{
748744
let wr = &mut wr as &mut dyn Write;
749-
write!(wr, "[{:?} of kind {:?} reads", ln, self.ir.lnk(ln));
745+
write!(wr, "[{:?} of kind {:?} reads", ln, self.ir.lnks[ln]);
750746
self.write_vars(wr, ln, |idx| self.rwu_table.get_reader(idx).is_valid());
751747
write!(wr, " writes");
752748
self.write_vars(wr, ln, |idx| self.rwu_table.get_writer(idx).is_valid());

0 commit comments

Comments
 (0)