[llvm] [Parallel] Ensure getThreadIndex()==0 for sequential tasks (PR #109084)
    Fangrui Song via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Sep 18 09:30:50 PDT 2024
    
    
  
================
@@ -217,13 +194,18 @@ TaskGroup::~TaskGroup() {
 void TaskGroup::spawn(std::function<void()> F, bool Sequential) {
 #if LLVM_ENABLE_THREADS
   if (Parallel) {
+    if (Sequential) {
+      // Act as worker thread 0.
+      threadIndex = 0;
----------------
MaskRay wrote:
Could you elaborate the expected code here? `threadIndex` is to satisfy lld ELF relocation's requirement. It does need `threadIndex == 0`. The initial `threadIndex` is UINT_MAX is for assertion https://reviews.llvm.org/D148916
https://github.com/llvm/llvm-project/pull/109084
    
    
More information about the llvm-commits
mailing list