[flang-commits] [flang] a93f37b - [flang][cmake] Order flang profdata generation after clang's (#206023)

via flang-commits flang-commits at lists.llvm.org
Mon Jun 29 21:55:08 PDT 2026


Author: Madhur Amilkanthwar
Date: 2026-06-30T10:25:04+05:30
New Revision: a93f37bc1adf296e1522ec11485ff597d5c9aa70

URL: https://github.com/llvm/llvm-project/commit/a93f37bc1adf296e1522ec11485ff597d5c9aa70
DIFF: https://github.com/llvm/llvm-project/commit/a93f37bc1adf296e1522ec11485ff597d5c9aa70.diff

LOG: [flang][cmake] Order flang profdata generation after clang's (#206023)

The clang and flang PGO pipelines clean and regenerate the same shared
profraw directories, so running them concurrently can truncate a profraw
while the other merge has it mmap'd. Add an ordering edge so flang's
pipeline runs after clang's.

Fixes issues introduced by
https://github.com/llvm/llvm-project/pull/198863

Added: 
    

Modified: 
    flang/test/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/flang/test/CMakeLists.txt b/flang/test/CMakeLists.txt
index 538432c05e14b..d582514206d5e 100644
--- a/flang/test/CMakeLists.txt
+++ b/flang/test/CMakeLists.txt
@@ -287,6 +287,17 @@ if(LLVM_BUILD_INSTRUMENTED)
         message(STATUS "CSSPGO of flang is not supported")
       else()
         add_dependencies(clang-bootstrap-deps generate-flang-profdata)
+        # When clang drives the bootstrap PGO, clang's generate-profdata is
+        # also a bootstrap provider, so both pipelines run concurrently and
+        # clean/regenerate the same shared profraw dirs, racing each other's
+        # merge. Order flang after clang to remove the race. generate-profdata
+        # already runs in this case, so this adds no extra work; when flang
+        # drives the bootstrap (provider is generate-flang-profdata) the guard
+        # keeps it a no-op.
+        if(TARGET generate-profdata AND
+           "${PGO_OPT_PROFDATA_PROVIDER}" STREQUAL "generate-profdata")
+          add_dependencies(generate-flang-profdata generate-profdata)
+        endif()
       endif()
     endif()
   endif()


        


More information about the flang-commits mailing list