about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-07-21 09:48:57 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2023-07-31 16:21:02 +1000
commit179bf19813af8b312da2529d3577a98be125c135 (patch)
treee62adafad5277d690323537de9d2abbd57ff3f45 /compiler/rustc_codegen_ssa/src
parentd21d31cce7675f9b454022827a304919ceb5e9f0 (diff)
downloadrust-179bf19813af8b312da2529d3577a98be125c135.tar.gz
rust-179bf19813af8b312da2529d3577a98be125c135.zip
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.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/write.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs
index d42d5fe0be2..a0e32752a99 100644
--- a/compiler/rustc_codegen_ssa/src/back/write.rs
+++ b/compiler/rustc_codegen_ssa/src/back/write.rs
@@ -1431,13 +1431,17 @@ fn start_executing_work<B: ExtraBackendMethods>(
 
             // Spin up what work we can, only doing this while we've got available
             // parallelism slots and work left to spawn.
-            while codegen_state != Aborted
-                && !work_items.is_empty()
-                && running_with_own_token < tokens.len()
-            {
-                let (item, _) = work_items.pop().unwrap();
-                spawn_work(&cgcx, &mut llvm_start_time, get_worker_id(&mut free_worker_ids), item);
-                running_with_own_token += 1;
+            if codegen_state != Aborted {
+                while !work_items.is_empty() && running_with_own_token < tokens.len() {
+                    let (item, _) = work_items.pop().unwrap();
+                    spawn_work(
+                        &cgcx,
+                        &mut llvm_start_time,
+                        get_worker_id(&mut free_worker_ids),
+                        item,
+                    );
+                    running_with_own_token += 1;
+                }
             }
 
             // Relinquish accidentally acquired extra tokens.