https://github.com/python/cpython/commit/d162c427904e232fec52d8da759caa1bfa4c01b5
commit: d162c427904e232fec52d8da759caa1bfa4c01b5
branch: main
author: Savannah Ostrowski <[email protected]>
committer: savannahostrowski <[email protected]>
date: 2025-11-12T18:09:25Z
summary:

GH-140479: Update JIT builds to use LLVM 21 (#140973)

files:
A 
Misc/NEWS.d/next/Core_and_Builtins/2025-11-04-04-57-24.gh-issue-140479.lwQ2v2.rst
M .github/workflows/jit.yml
M PCbuild/get_externals.bat
M Tools/jit/README.md
M Tools/jit/_llvm.py

diff --git a/.github/workflows/jit.yml b/.github/workflows/jit.yml
index 69d900091a3bd1..62325250bd368e 100644
--- a/.github/workflows/jit.yml
+++ b/.github/workflows/jit.yml
@@ -68,7 +68,7 @@ jobs:
           - true
           - false
         llvm:
-          - 20
+          - 21
         include:
           - target: i686-pc-windows-msvc/msvc
             architecture: Win32
@@ -138,7 +138,7 @@ jobs:
       fail-fast: false
       matrix:
         llvm:
-          - 20
+          - 21
     steps:
       - uses: actions/checkout@v4
         with:
@@ -166,7 +166,7 @@ jobs:
       fail-fast: false
       matrix:
         llvm:
-          - 20
+          - 21
     steps:
       - uses: actions/checkout@v4
         with:
@@ -193,7 +193,7 @@ jobs:
       fail-fast: false
       matrix:
         llvm:
-          - 20
+          - 21
     steps:
       - uses: actions/checkout@v4
         with:
diff --git 
a/Misc/NEWS.d/next/Core_and_Builtins/2025-11-04-04-57-24.gh-issue-140479.lwQ2v2.rst
 
b/Misc/NEWS.d/next/Core_and_Builtins/2025-11-04-04-57-24.gh-issue-140479.lwQ2v2.rst
new file mode 100644
index 00000000000000..0a615ed131127f
--- /dev/null
+++ 
b/Misc/NEWS.d/next/Core_and_Builtins/2025-11-04-04-57-24.gh-issue-140479.lwQ2v2.rst
@@ -0,0 +1 @@
+Update JIT compilation to use LLVM 21 at build time.
diff --git a/PCbuild/get_externals.bat b/PCbuild/get_externals.bat
index 115203cecc8e48..9d02e2121cc623 100644
--- a/PCbuild/get_externals.bat
+++ b/PCbuild/get_externals.bat
@@ -82,7 +82,7 @@ if NOT "%IncludeLibffi%"=="false"  set binaries=%binaries% 
libffi-3.4.4
 if NOT "%IncludeSSL%"=="false"     set binaries=%binaries% openssl-bin-3.0.18
 if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.15.0
 if NOT "%IncludeSSLSrc%"=="false"  set binaries=%binaries% nasm-2.11.06
-if NOT "%IncludeLLVM%"=="false"    set binaries=%binaries% llvm-20.1.8.0
+if NOT "%IncludeLLVM%"=="false"    set binaries=%binaries% llvm-21.1.4.0
 
 for %%b in (%binaries%) do (
     if exist "%EXTERNALS_DIR%\%%b" (
@@ -92,7 +92,7 @@ for %%b in (%binaries%) do (
         git clone --depth 1 https://github.com/%ORG%/cpython-bin-deps --branch 
%%b "%EXTERNALS_DIR%\%%b"
     ) else (
         echo.Fetching %%b...
-        if "%%b"=="llvm-20.1.8.0" (
+        if "%%b"=="llvm-21.1.4.0" (
             %PYTHON% -E "%PCBUILD%\get_external.py" --release --organization 
%ORG% --externals-dir "%EXTERNALS_DIR%" %%b
         ) else (
             %PYTHON% -E "%PCBUILD%\get_external.py" --binary --organization 
%ORG% --externals-dir "%EXTERNALS_DIR%" %%b
diff --git a/Tools/jit/README.md b/Tools/jit/README.md
index d83b09aab59f8c..dd7deb7b256449 100644
--- a/Tools/jit/README.md
+++ b/Tools/jit/README.md
@@ -9,32 +9,32 @@ Python 3.11 or newer is required to build the JIT.
 
 The JIT compiler does not require end users to install any third-party 
dependencies, but part of it must be *built* using LLVM[^why-llvm]. You are 
*not* required to build the rest of CPython using LLVM, or even the same 
version of LLVM (in fact, this is uncommon).
 
-LLVM version 20 is the officially supported version. You can modify if needed 
using the `LLVM_VERSION` env var during configure. Both `clang` and 
`llvm-readobj` need to be installed and discoverable (version suffixes, like 
`clang-19`, are okay). It's highly recommended that you also have 
`llvm-objdump` available, since this allows the build script to dump 
human-readable assembly for the generated code.
+LLVM version 21 is the officially supported version. You can modify if needed 
using the `LLVM_VERSION` env var during configure. Both `clang` and 
`llvm-readobj` need to be installed and discoverable (version suffixes, like 
`clang-19`, are okay). It's highly recommended that you also have 
`llvm-objdump` available, since this allows the build script to dump 
human-readable assembly for the generated code.
 
 It's easy to install all of the required tools:
 
 ### Linux
 
-Install LLVM 20 on Ubuntu/Debian:
+Install LLVM 21 on Ubuntu/Debian:
 
 ```sh
 wget https://apt.llvm.org/llvm.sh
 chmod +x llvm.sh
-sudo ./llvm.sh 20
+sudo ./llvm.sh 21
 ```
 
-Install LLVM 20 on Fedora Linux 40 or newer:
+Install LLVM 21 on Fedora Linux 40 or newer:
 
 ```sh
-sudo dnf install 'clang(major) = 20' 'llvm(major) = 20'
+sudo dnf install 'clang(major) = 21' 'llvm(major) = 21'
 ```
 
 ### macOS
 
-Install LLVM 20 with [Homebrew](https://brew.sh):
+Install LLVM 21 with [Homebrew](https://brew.sh):
 
 ```sh
-brew install llvm@20
+brew install llvm@21
 ```
 
 Homebrew won't add any of the tools to your `$PATH`. That's okay; the build 
script knows how to find them.
@@ -43,18 +43,18 @@ Homebrew won't add any of the tools to your `$PATH`. That's 
okay; the build scri
 
 LLVM is downloaded automatically (along with other external binary 
dependencies) by `PCbuild\build.bat`.
 
-Otherwise, you can install LLVM 20 [by searching for it on LLVM's GitHub 
releases page](https://github.com/llvm/llvm-project/releases?q=20), clicking on 
"Assets", downloading the appropriate Windows installer for your platform 
(likely the file ending with `-win64.exe`), and running it. **When installing, 
be sure to select the option labeled "Add LLVM to the system PATH".**
+Otherwise, you can install LLVM 21 [by searching for it on LLVM's GitHub 
releases page](https://github.com/llvm/llvm-project/releases?q=21), clicking on 
"Assets", downloading the appropriate Windows installer for your platform 
(likely the file ending with `-win64.exe`), and running it. **When installing, 
be sure to select the option labeled "Add LLVM to the system PATH".**
 
 Alternatively, you can use [chocolatey](https://chocolatey.org):
 
 ```sh
-choco install llvm --version=20.1.8
+choco install llvm --version=21.1.0
 ```
 
 ### Dev Containers
 
 If you are working on CPython in a [Codespaces 
instance](https://devguide.python.org/getting-started/setup-building/#using-codespaces),
 there's no 
-need to install LLVM as the Fedora 42 base image includes LLVM 20 out of the 
box.
+need to install LLVM as the Fedora 43 base image includes LLVM 21 out of the 
box.
 
 ## Building
 
diff --git a/Tools/jit/_llvm.py b/Tools/jit/_llvm.py
index f1b0ad3f5dbc43..0b9cb5192f1b75 100644
--- a/Tools/jit/_llvm.py
+++ b/Tools/jit/_llvm.py
@@ -11,8 +11,8 @@
 import _targets
 
 
-_LLVM_VERSION = "20"
-_EXTERNALS_LLVM_TAG = "llvm-20.1.8.0"
+_LLVM_VERSION = "21"
+_EXTERNALS_LLVM_TAG = "llvm-21.1.4.0"
 
 _P = typing.ParamSpec("_P")
 _R = typing.TypeVar("_R")

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to