@@ -2594,8 +2594,8 @@ impl Block {
25942594 self.insns.iter()
25952595 }
25962596
2597- pub fn terminator(&self) -> & InsnId {
2598- self.insns().last().unwrap()
2597+ pub fn terminator(&self) -> InsnId {
2598+ * self.insns().last().unwrap()
25992599 }
26002600}
26012601
@@ -6606,7 +6606,7 @@ impl Function {
66066606 // Collect blocks that terminate with Jump or CondBranch instructions that pass at least one block param along.
66076607 let blocks_sending_params: Vec<BlockId> = blocks.iter().copied()
66086608 .filter(|&block_id|
6609- self.resolve(* self.blocks[block_id].terminator()).insn(self).outgoing_edges().any(|edge| !edge.args.is_empty()))
6609+ self.resolve(self.blocks[block_id].terminator()).insn(self).outgoing_edges().any(|edge| !edge.args.is_empty()))
66106610 .collect();
66116611
66126612 // We only need to update blocks that have params. (Blocks without params cannot be improved)
@@ -6638,7 +6638,7 @@ impl Function {
66386638 for &block_id in &blocks_sending_params {
66396639 // Use the results of abstract interpretation to update the states
66406640 // Perform abstract interpretation
6641- let edges = self.resolve(* self.blocks[block_id].terminator()).insn(self).outgoing_edges();
6641+ let edges = self.resolve(self.blocks[block_id].terminator()).insn(self).outgoing_edges();
66426642 for BranchEdge { target: target_block_id, args: params } in edges {
66436643 for (i, param) in params.iter().enumerate() {
66446644 let param = self.find_id(*param);
@@ -6689,7 +6689,7 @@ impl Function {
66896689
66906690 // Update the terminators (basic blocks can only branch at the terminator. This is where block params are passed)
66916691 for jump_block_id in &blocks_sending_params {
6692- let edges = self.resolve(* self.blocks[*jump_block_id].terminator()).insn_mut(self).outgoing_edges_mut();
6692+ let edges = self.resolve(self.blocks[*jump_block_id].terminator()).insn_mut(self).outgoing_edges_mut();
66936693 for edge in edges {
66946694 if edge.target == *block_id {
66956695 prune_vec_by_indices(&mut edge.args, &trivial_indices);
@@ -6728,8 +6728,7 @@ impl Function {
67286728 loop {
67296729 for (rpo_index, &block_id) in rpo.iter().enumerate() {
67306730 let mut block_cache: HashMap<Key, InsnId> = HashMap::new();
6731- // Populate the block cache with information from predecessors
6732- // If all predecessors contain the same entry and value, add it to the map
6731+ // Set block_cache equal to the intersection of cached insns of all predecessors
67336732 match cfi.predecessors(block_id) {
67346733 [] => {},
67356734 [head] => {
@@ -6799,9 +6798,9 @@ impl Function {
67996798 continue
68006799 }
68016800 }
6802- Entry::Vacant(_ ) => {
6801+ Entry::Vacant(entry ) => {
68036802 // If the value has not been accessed, cache a copy to optimize future loads or stores.
6804- block_cache .insert(key, insn_id);
6803+ entry .insert(insn_id);
68056804 }
68066805 }
68076806 insn_id
@@ -6829,7 +6828,7 @@ impl Function {
68296828 self.blocks[block_id].insns = new_insns;
68306829
68316830 // Check for back edges
6832- for edge in self.resolve(* self.blocks[block_id].terminator()).insn(self).outgoing_edges() {
6831+ for edge in self.resolve(self.blocks[block_id].terminator()).insn(self).outgoing_edges() {
68336832 if rpo_order[edge.target] <= rpo_index {
68346833 has_back_edge |= true;
68356834 }
0 commit comments