Update to hashbrown 0.9

This commit is contained in:
Matt Brubeck 2020-09-03 15:38:57 -07:00
parent 3b0f3a0a1e
commit bd2313fc11
2 changed files with 5 additions and 8 deletions

View File

@ -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/"]

View File

@ -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));
}