Skip to content

Commit

Permalink
Update to hashbrown 0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrubeck committed Sep 3, 2020
1 parent 3b0f3a0 commit bd2313f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -23,7 +23,7 @@ byteorder = "1.2.7"
indexmap = "1.0.2"
cfg-if = "0.1.10"
libloading = { version = "0.6.0", optional = true }
hashbrown = "0.8.1"
hashbrown = "0.9.0"

# Uncomment to use local checkout of cranelift
#[patch."https://github.com/bytecodealliance/wasmtime/"]
Expand Down
11 changes: 4 additions & 7 deletions src/optimize/stack2reg.rs
Expand Up @@ -389,27 +389,24 @@ fn remove_unused_stack_addr_and_stack_load(opt_ctx: &mut OptimizeContext<'_>) {
// Replace all unused stack_addr and stack_load instructions with nop.
let mut func = &mut opt_ctx.ctx.func;

// drain_filter() on hashbrown::HashSet drains the items that do *not* match the
// predicate. Once hashbrown gets updated to match the behaviour of std::drain_filter
// (0.8.2), the predicate will have to be reversed
for stack_slot_users in opt_ctx.stack_slot_usage_map.values_mut() {
stack_slot_users
.stack_addr
.drain_filter(|inst| {
!(stack_addr_load_insts_users
stack_addr_load_insts_users
.get(inst)
.map(|users| users.is_empty())
.unwrap_or(true))
.unwrap_or(true)
})
.for_each(|inst| StackSlotUsage::remove_unused_stack_addr(&mut func, inst));

stack_slot_users
.stack_load
.drain_filter(|inst| {
!(stack_addr_load_insts_users
stack_addr_load_insts_users
.get(inst)
.map(|users| users.is_empty())
.unwrap_or(true))
.unwrap_or(true)
})
.for_each(|inst| StackSlotUsage::remove_unused_load(&mut func, inst));
}
Expand Down

0 comments on commit bd2313f

Please sign in to comment.