You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT assembly optimizer leaves some redundant branches #139757
This doesn't seem to be an issue for x86, possibly due to the way Clang is setup for AArch64, possibly just an artefact of llvm's code gen.
Either way, rather than rely on llvm eliminating these jumps we can do it in the JIT builder's assembly optimizer.
Currently we don't perform jump fusion, but it would be easy enough to do so.
The introduction of _remove_unreachable broke the JIT + FT builds on x86-64.
I get this error:
0. Program arguments: clang-21 --target=x86_64-unknown-linux-gnu -c -o /tmp/tmpbw0scowv/_LOAD_ATTR_WITH_HINT_r11.o /tmp/tmpbw0scowv/_LOAD_ATTR_WITH_HINT_r11.s
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
Alright, I narrowed it down: for some stencils, there are more than one entry points, e.g. if PyStackRef_CLOSE is outlined, then a stencil may have two entry points (one _JIT_ENTRY, one PyStackRef_CLOSE).
The problem with that is that we don't treat call PyStackRef_CLOSE as a jump to a live block. So this optimization breaks.
A possible fix is to just treat all function entries as live.
Activity
GH-139757: Fix reference leaks introduced in GH-140800 (GH-142257)
pythonGH-139757: Fix reference leaks introduced in pythonGH-140800 (p…
GH-139757: JIT: Remove redundant branches to jumps in the assembly op…
Fidget-Spinner commentedon Dec 17, 2025
The introduction of
_remove_unreachablebroke the JIT + FT builds on x86-64.I get this error:
Commenting it out fixes it.
Fidget-Spinner commentedon Dec 17, 2025
Alright, I narrowed it down: for some stencils, there are more than one entry points, e.g. if
PyStackRef_CLOSEis outlined, then a stencil may have two entry points (one _JIT_ENTRY, one PyStackRef_CLOSE).The problem with that is that we don't treat
call PyStackRef_CLOSEas a jump to a live block. So this optimization breaks.A possible fix is to just treat all function entries as live.
gh-139757: Treat call specially in JIT assembly backend optimizer on …
pythongh-139757: Add _GUARD_NOS_COMPACT_ASCII for compact ascii optim…
Merge remote-tracking branch 'upstream/main' into pythongh-139757-gua…
gh-139757: Add _GUARD_NOS_COMPACT_ASCII for compact ascii optimization (
pythongh-139757: Fix unintended BINARY_OP_SUBSCR_STR_INT for non-ASCII
gh-139757: Fix unintended bytecode specialization for non-ascii string (
gh-139757: Add BINARY_OP_SUBSCR_USTR_INT (GH-143389)
pythongh-139757: Add _GUARD_NOS_COMPACT_ASCII for compact ascii optim…
pythongh-139757: Fix unintended bytecode specialization for non-ascii…
pythongh-139757: Add BINARY_OP_SUBSCR_USTR_INT (pythonGH-143389)
markshannon commentedon Mar 23, 2026
I think this is done