You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a8a5d1e
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: zjit/src/hir.rs
+19-19Lines changed: 19 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -6743,6 +6743,13 @@ impl Function {
6743
6743
// The cache is pruned when loads and stores can alias between objects.
6744
6744
let mut cached_insns: Vec<HashMap<Key, InsnId>> = vec![HashMap::new(); cfi.num_blocks];
6745
6745
6746
+
// An available expression is an expression that has already been computed with values that have not changed since the last computation.
6747
+
// In this case, available expressions == redundant loads and stores
6748
+
// To compute the available expressions, we need to know which expressions have been evaluated, and when effectful operations interrupt the optimization.
6749
+
// This information is stored in cached_insns and is used to populate available_expressions.
6750
+
// Once the fixpoint loop is finished, we elide all available expressions, concluding the load store forwarding pass.
6751
+
let mut available_expressions: InsnSet = InsnSet::with_capacity(self.insns.len());
6752
+
6746
6753
loop {
6747
6754
for (rpo_index, &block_id) in rpo.iter().enumerate() {
6748
6755
// Set block_cache equal to the intersection of cached insns of all predecessors
@@ -6767,22 +6774,17 @@ impl Function {
6767
6774
6768
6775
}
6769
6776
};
6770
-
let old_insns = std::mem::take(&mut self.blocks[block_id].insns);
6771
-
let mut new_insns = Vec::with_capacity(old_insns.len());
6772
-
for insn_id in old_insns {
6773
-
let replacement_insn: InsnId = match self.resolve(insn_id).insn(self) {
6777
+
let insns = std::mem::take(&mut self.blocks[block_id].insns);
6778
+
for insn_id in insns.iter() {
6779
+
match self.resolve(*insn_id).insn(self) {
6774
6780
&Insn::StoreField { recv, offset, val, .. } => {
6775
6781
let key = Key { id: self.chase_insn(recv), offset };
6776
6782
let heap_entry = block_cache.get(&key).copied();
6777
-
// TODO(Jacob): Switch from actual to partial equality
6778
6783
if Some(val) == heap_entry {
6779
-
// If the value is already stored, short circuit and don't add an instruction to the block
6780
-
continue
6784
+
available_expressions.insert(*insn_id);
6781
6785
}
6782
-
// TODO(Jacob): Add type based alias analysis to avoid removing so many entries
0 commit comments