Skip to content

Commit

Permalink
merging
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Faith Boyland committed Aug 19, 2022
2 parents f90dcf3 + 14d2398 commit 655d0b4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pdg/src/info.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use crate::graph::{Graph, GraphId, Graphs, Node, NodeId, NodeKind};
use itertools::Itertools;
use rustc_index::vec::IndexVec;
use rustc_middle::mir::Field;
use std::collections::HashMap;
use std::collections::HashSet;
use std::cmp;
use itertools::Itertools;
use std::fmt::{self, Debug, Display, Formatter};

/// The information checked in this struct is whether nodes flow to loads, stores, and offsets (pos
Expand Down Expand Up @@ -70,7 +69,7 @@ fn collect_children (g: &Graph) -> HashMap<NodeId,Vec<NodeId>> {
for (par,chi) in g.nodes.iter_enumerated().filter_map(|(idx,node)| Some((node.source?,idx))){
m.entry(par).or_insert_with(Vec::new).push(chi)
};
for (par,chi) in g.nodes.iter_enumerated(){
for (par,_) in g.nodes.iter_enumerated(){
m.try_insert(par,Vec::new());
};
m
Expand Down Expand Up @@ -126,15 +125,15 @@ fn determine_non_conflicting(g: &Graph, downward: &HashMap<NodeId,Vec<NodeId>>,
ids.sort();
check_sibling_conflict(ids,flow_info,&mut result);
}
for (id,n) in g.nodes.iter_enumerated() {
for (id,_) in g.nodes.iter_enumerated() {
let mut children = downward.get(&id).unwrap().clone();
children = children.into_iter().filter(|x| copy_or_offset(g.nodes.get(*x).unwrap())).collect::<Vec<NodeId>>();
if !children.is_empty() {
check_sibling_conflict(&mut children,flow_info,&mut result);
}
}
for id in g.nodes.indices() {
let mut children = downward.get(&id).unwrap().clone();
let children = downward.get(&id).unwrap().clone();
match children.iter().find(|cidx| result.get(cidx).is_some()){
None => (),
Some(failchild) => {result.insert(id,*result.get(failchild).unwrap()); ()},
Expand All @@ -161,10 +160,11 @@ impl Display for NodeInfo {
("+offset", self.flows_to_neg_offset),
("-offset", self.flows_to_neg_offset),
("non unique by", self.non_unique),
].into_iter()
.filter_map(|(name,node)| Some((name,node?)))
]
.into_iter()
.filter_map(|(name, node)| Some((name, node?)))
.format_with(", ", |(name, node), f| f(&format_args!("{name} {node}")));
write!(f,"{}", s)
write!(f, "{}", s)
}
}

Expand Down

0 comments on commit 655d0b4

Please sign in to comment.