Run dead stack_store removal after stack_store to stack_load forwarding
This commit is contained in:
parent
7d35db5319
commit
c5f42aef1d
@ -84,10 +84,6 @@ pub(super) fn optimize_function(
|
||||
continue;
|
||||
}
|
||||
|
||||
let is_loaded = users.stack_load.is_empty().not();
|
||||
let is_stored = users.stack_store.is_empty().not();
|
||||
match (is_loaded, is_stored) {
|
||||
(true, true) => {
|
||||
for load in users.stack_load.clone().drain() {
|
||||
let load_ebb = func.layout.inst_ebb(load).unwrap();
|
||||
let loaded_value = func.dfg.inst_results(load)[0];
|
||||
@ -119,22 +115,23 @@ pub(super) fn optimize_function(
|
||||
func.dfg.detach_results(load);
|
||||
func.dfg.replace(load).nop();
|
||||
func.dfg.change_to_alias(loaded_value, stored_value);
|
||||
users.stack_load.remove(&load);
|
||||
}
|
||||
}
|
||||
_ => {} // FIXME implement this
|
||||
}
|
||||
}
|
||||
}
|
||||
(true, false) => println!("[{}] [BUG?] Reading uninitialized memory", name),
|
||||
(false, _) => {
|
||||
|
||||
if users.stack_load.is_empty() {
|
||||
// Never loaded; can safely remove all stores and the stack slot.
|
||||
for user in users.stack_store.drain() {
|
||||
println!("[{}] Remove dead stack store {} of {}", name, user, stack_slot.0);
|
||||
func.dfg.replace(user).nop();
|
||||
}
|
||||
|
||||
// FIXME make stack_slot zero sized.
|
||||
}
|
||||
|
||||
if users.stack_store.is_empty() && users.stack_load.is_empty() {
|
||||
// FIXME make stack_slot zero sized.
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user