@@ -97,10 +97,41 @@ jobs:
9797 llvm-mingw-*.tar.xz
9898 retention-days : 7
9999
100+ linux-profile :
101+ if : (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
102+ needs : [prepare, linux-stage1]
103+ runs-on : ubuntu-22.04
104+ steps :
105+ - uses : actions/checkout@v4
106+ - uses : actions/download-artifact@v4
107+ with :
108+ name : linux-stage1-ucrt-x86_64-toolchain
109+ - name : Unpack stage1 Clang
110+ run : |
111+ tar -Jxf llvm-mingw-*.tar.xz
112+ rm llvm-mingw-*.tar.xz
113+ mv llvm-mingw* llvm-mingw-stage1
114+ - name : Build
115+ env :
116+ LLVM_VERSION : ${{needs.prepare.outputs.LLVM_VERSION}}
117+ TAG : ${{needs.prepare.outputs.TAG}}
118+ SOURCE_DATE_EPOCH : ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
119+ BUILD_DATE : ${{needs.prepare.outputs.BUILD_DATE}}
120+ run : |
121+ # Build LLVM in mostly the same way as it is going to be built in the
122+ # final form.
123+ LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh --profile $(pwd)/llvm-mingw-stage1
124+ - uses : actions/upload-artifact@v4
125+ with :
126+ name : profile
127+ path : |
128+ profile.profdata
129+ retention-days : 7
130+
100131 # Build a cross compiler for Linux, targeting Windows.
101132 linux :
102133 if : (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
103- needs : [prepare, linux-stage1]
134+ needs : [prepare, linux-stage1, linux-profile ]
104135 runs-on : ubuntu-22.04
105136 steps :
106137 - uses : actions/checkout@v4
@@ -112,20 +143,20 @@ jobs:
112143 tar -Jxf llvm-mingw-*.tar.xz
113144 rm llvm-mingw-*.tar.xz
114145 sudo mv llvm-mingw* /opt/llvm-mingw
115- echo /opt/llvm-mingw/bin >> $GITHUB_PATH
146+ - uses : actions/download-artifact@v4
147+ with :
148+ name : profile
116149 - name : Build
117150 env :
118151 LLVM_VERSION : ${{needs.prepare.outputs.LLVM_VERSION}}
119152 TAG : ${{needs.prepare.outputs.TAG}}
120153 SOURCE_DATE_EPOCH : ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
121154 BUILD_DATE : ${{needs.prepare.outputs.BUILD_DATE}}
122155 run : |
123- mkdir -p install
124- cp -a /opt/llvm-mingw install
125156 # Skip dynamic library dependencies that might make it harder to
126157 # run the binaries on other distros (and that have little use within
127158 # llvm-mingw).
128- LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --with-clang --thinlto --llvm-only
159+ LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh /opt/llvm-mingw $(pwd)/install/llvm-mingw --thinlto --pgo --llvm-only
129160 .github/workflows/store-version.sh install/llvm-mingw/versions.txt
130161 ./test-libcxx-module.sh $(pwd)/install/llvm-mingw
131162 ./run-tests.sh $(pwd)/install/llvm-mingw
@@ -145,7 +176,7 @@ jobs:
145176 # libraries that were built in the 'linux' step above.
146177 linux-cross-aarch64 :
147178 if : (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
148- needs : [linux-stage1, prepare]
179+ needs : [linux-stage1, linux-profile, prepare]
149180 runs-on : ubuntu-22.04
150181 steps :
151182 - uses : actions/checkout@v4
@@ -157,15 +188,17 @@ jobs:
157188 tar -Jxf llvm-mingw-*.tar.xz
158189 rm llvm-mingw-*.tar.xz
159190 sudo mv llvm-mingw* /opt/llvm-mingw
160- echo /opt/llvm-mingw/bin >> $GITHUB_PATH
191+ - uses : actions/download-artifact@v4
192+ with :
193+ name : profile
161194 - name : Build
162195 env :
163196 LLVM_VERSION : ${{needs.prepare.outputs.LLVM_VERSION}}
164197 MINGW_W64_VERSION : ${{needs.prepare.outputs.MINGW_W64_VERSION}}
165198 SOURCE_DATE_EPOCH : ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
166199 run : |
167200 sudo apt-get update && sudo apt-get install g++-aarch64-linux-gnu
168- ./build-all.sh $(pwd)/install/llvm-mingw --no-runtimes --host=aarch64-linux-gnu --with-clang --thinlto
201+ ./build-all.sh /opt/llvm-mingw $(pwd)/install/llvm-mingw --no-runtimes --host=aarch64-linux-gnu --thinlto --pgo
169202 .github/workflows/store-version.sh install/llvm-mingw/versions.txt
170203 - name : Assemble the cross-built toolchain
171204 run : |
@@ -259,7 +292,7 @@ jobs:
259292 # Build a cross compiler for macOS, targeting Windows.
260293 macos :
261294 if : (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
262- needs : [prepare, macos-stage1]
295+ needs : [prepare, macos-stage1, linux-profile ]
263296 runs-on : macos-latest
264297 steps :
265298 - uses : actions/checkout@v4
@@ -271,7 +304,9 @@ jobs:
271304 tar -Jxf llvm-*.tar.xz
272305 rm llvm-*.tar.xz
273306 mv llvm* $HOME/llvm
274- echo $HOME/llvm/bin >> $GITHUB_PATH
307+ - uses : actions/download-artifact@v4
308+ with :
309+ name : profile
275310 - name : Build
276311 env :
277312 LLVM_VERSION : ${{needs.prepare.outputs.LLVM_VERSION}}
@@ -285,8 +320,7 @@ jobs:
285320 # form. Therefore, autodetection will pick them up, but linking
286321 # universal binaries fails as those libraries are unavailable in the
287322 # other (x86_64) architecture form.
288- export SDKROOT=$(xcrun --show-sdk-path)
289- MACOS_REDIST=1 LLVM_CMAKEFLAGS="-DLLVM_ENABLE_ZSTD=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --with-clang --thinlto
323+ MACOS_REDIST=1 LLVM_CMAKEFLAGS="-DLLVM_ENABLE_ZSTD=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $HOME/llvm $(pwd)/install/llvm-mingw --thinlto --pgo
290324 .github/workflows/store-version.sh install/llvm-mingw/versions.txt
291325 ./test-libcxx-module.sh $(pwd)/install/llvm-mingw
292326 ./run-tests.sh $(pwd)/install/llvm-mingw
@@ -363,7 +397,7 @@ jobs:
363397 # architectures). The binaries built here match actual releases quite closely.
364398 linux-cross-windows :
365399 if : (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
366- needs : [linux-stage1, prepare]
400+ needs : [linux-stage1, linux-profile, prepare]
367401 runs-on : ubuntu-latest
368402 strategy :
369403 fail-fast : false
@@ -384,6 +418,9 @@ jobs:
384418 sudo mv llvm-mingw* /opt/llvm-mingw
385419 echo /opt/llvm-mingw/bin >> $GITHUB_PATH
386420 - uses : actions/checkout@v4
421+ - uses : actions/download-artifact@v4
422+ with :
423+ name : profile
387424 - name : Build
388425 env :
389426 LLVM_VERSION : ${{needs.prepare.outputs.LLVM_VERSION}}
@@ -394,7 +431,7 @@ jobs:
394431 BUILD_DATE : ${{needs.prepare.outputs.BUILD_DATE}}
395432 run : |
396433 sudo apt-get update && sudo apt-get install libltdl-dev swig autoconf-archive
397- ./build-cross-tools.sh /opt/llvm-mingw $(pwd)/install/llvm-mingw ${{matrix.arch}} --with-python --thinlto
434+ ./build-cross-tools.sh /opt/llvm-mingw $(pwd)/install/llvm-mingw ${{matrix.arch}} --with-python --thinlto --pgo
398435 .github/workflows/store-version.sh install/llvm-mingw/versions.txt
399436 cd install
400437 NAME=llvm-mingw-$TAG-${{matrix.crt}}-${{matrix.arch}}
@@ -774,6 +811,7 @@ jobs:
774811 rm -rf msys2*
775812 rm -rf linux-stage1-*
776813 rm -rf macos-llvm*
814+ rm -rf profile*
777815 mv *-toolchain/*.zip *-toolchain/*.tar.xz .
778816 - name : Upload binaries
779817 env :
0 commit comments