Skip to content

Commit 179bf19

Browse files
committed
Tweak a loop condition.
This loop condition involves `codegen_state`, `work_items`, and `running_with_own_token`. But the body of the loop cannot modify `codegen_state`, so repeatedly checking it is unnecessary.
1 parent d21d31c commit 179bf19

File tree

1 file changed

+11
-7
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+11
-7
lines changed

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,13 +1431,17 @@ fn start_executing_work<B: ExtraBackendMethods>(
14311431

14321432
// Spin up what work we can, only doing this while we've got available
14331433
// parallelism slots and work left to spawn.
1434-
while codegen_state != Aborted
1435-
&& !work_items.is_empty()
1436-
&& running_with_own_token < tokens.len()
1437-
{
1438-
let (item, _) = work_items.pop().unwrap();
1439-
spawn_work(&cgcx, &mut llvm_start_time, get_worker_id(&mut free_worker_ids), item);
1440-
running_with_own_token += 1;
1434+
if codegen_state != Aborted {
1435+
while !work_items.is_empty() && running_with_own_token < tokens.len() {
1436+
let (item, _) = work_items.pop().unwrap();
1437+
spawn_work(
1438+
&cgcx,
1439+
&mut llvm_start_time,
1440+
get_worker_id(&mut free_worker_ids),
1441+
item,
1442+
);
1443+
running_with_own_token += 1;
1444+
}
14411445
}
14421446

14431447
// Relinquish accidentally acquired extra tokens.

0 commit comments

Comments
 (0)