# LLVM 19 for JIT on 3.13? Maybe \>= 19 for 3.14+?

**URL:** <https://discuss.python.org/t/llvm-19-for-jit-on-3-13-maybe-19-for-3-14/73425>\
**Category:** Core Development\
**Created:** [December 5, 2024, 9:22pm UTC](https://discuss.python.org/t/llvm-19-for-jit-on-3-13-maybe-19-for-3-14/73425 "2024-12-05T21:22:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![smontanaro](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/smontanaro/32/1389_2.png) [@smontanaro](https://discuss.python.org/u/smontanaro)\
**Post date:** [December 5, 2024, 9:22pm UTC](https://discuss.python.org/t/llvm-19-for-jit-on-3-13-maybe-19-for-3-14/73425/1 "2024-12-05T21:22:17Z")

</div>

I’m just messing around, but was curious why LLVM\_VERSION is fixed at v18 for Python 3.13 instead of the equivalent of `>=18` I imagine when the JIT work started for 3.13, LLVM 18 was the current stable version, so a fixed version requirement didn’t really cost anything.

I just bumped `LLVM_VERSION` in `Tools/jit/_llvm.py` to 19 and built from scratch. Everything worked fine (the only test failure was `test_ssl` which fails frequently). Maybe the version requirement should be loosened for 3.14 to be at least 19? OTOH, maybe LLVM 20 won’t have been released by the time 3.14 is, so it will be an unknown quantity.

Again, just messing around…

---

<div class="post-metadata">

**Author:** ![brandtbucher](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/brandtbucher/32/22862_2.png) [@brandtbucher](https://discuss.python.org/u/brandtbucher)\
**Post date:** [December 5, 2024, 11:36pm UTC](https://discuss.python.org/t/llvm-19-for-jit-on-3-13-maybe-19-for-3-14/73425/2 "2024-12-05T23:36:00Z")

</div>

Good question! In 3.13 (and early 3.14), we used an [ugly performance hack](https://github.com/python/cpython/blob/304111e96741ff94c1970fe3f2ab9c804e78ecb8/Tools/jit/_targets.py#L145-L177) that involved textual manipulation of LLVM IR. It worked fine for our purposes, but it felt like it might be too fragile to survive unknown LLVM upgrades.

Thankfully, we don’t do anything like that anymore. I’d _probably_ be okay with only enforcing a lower bound on the LLVM version (or perhaps a range of versions) if that would make things easier for people. We might only want to test with the lowest version, though, and maybe print a warning if untested newer versions are used instead.

I could see a future LLVM using new relocations or something that our build scripts can’t handle. Printing “That didn’t work… try LLVM 19!” would probably be a good enough fallback.

---

<div class="post-metadata">

**Author:** ![h-vetinari](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/h-vetinari/32/1220_2.png) [@h-vetinari](https://discuss.python.org/u/h-vetinari)\
**Post date:** [March 25, 2025, 2:28am UTC](https://discuss.python.org/t/llvm-19-for-jit-on-3-13-maybe-19-for-3-14/73425/3 "2025-03-25T02:28:53Z")

</div>

> [@smontanaro](#):
>
> maybe LLVM 20 won’t have been released by the time 3.14 is, so it will be an unknown quantity.

LLVM has a predictable release cycle of: even versions in ~March and odd versions in ~October. v20.1 is out since about a month already.
