Skip to content

Commit c62f433

Browse files
committed
remove_unused_stack_addr_and_stack_load: Remove clone()
1 parent 18348b1 commit c62f433

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/optimize/stack2reg.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,13 @@ fn remove_unused_stack_addr_and_stack_load(opt_ctx: &mut OptimizeContext<'_>) {
315315

316316
// Replace all unused stack_addr and stack_load instructions with nop.
317317
for stack_slot_users in opt_ctx.stack_slot_usage_map.values_mut() {
318-
// FIXME remove clone
319-
for &inst in stack_slot_users.stack_addr.clone().iter() {
318+
while let Some(&inst) = stack_slot_users.stack_addr.iter().next() {
320319
if stack_addr_load_insts_users.get(&inst).map(|users| users.is_empty()).unwrap_or(true) {
321320
stack_slot_users.remove_unused_stack_addr(&mut opt_ctx.ctx.func, inst);
322321
}
323322
}
324323

325-
for &inst in stack_slot_users.stack_load.clone().iter() {
324+
while let Some(&inst) = stack_slot_users.stack_load.iter().next() {
326325
if stack_addr_load_insts_users.get(&inst).map(|users| users.is_empty()).unwrap_or(true) {
327326
stack_slot_users.remove_unused_load(&mut opt_ctx.ctx.func, inst);
328327
}

0 commit comments

Comments
 (0)