diff options
author | Tomas R. <tomas.roun8@gmail.com> | 2025-06-07 01:44:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-06 16:44:43 -0700 |
commit | 46151648ca8ba1edd2a2783e8e154692a13d8ea8 (patch) | |
tree | 0c03ca4f658e06335409cc89342ad3dce14450c4 /Python/optimizer_cases.c.h | |
parent | f00512db20561370faad437853f6ecee0eec4856 (diff) | |
download | cpython-46151648ca8ba1edd2a2783e8e154692a13d8ea8.tar.gz cpython-46151648ca8ba1edd2a2783e8e154692a13d8ea8.zip |
GH-131798: Optimize away type(x) in the JIT when the result is known (GH-135194)
Diffstat (limited to 'Python/optimizer_cases.c.h')
-rw-r--r-- | Python/optimizer_cases.c.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Python/optimizer_cases.c.h b/Python/optimizer_cases.c.h index 960c6838004..1a2d49973ee 100644 --- a/Python/optimizer_cases.c.h +++ b/Python/optimizer_cases.c.h @@ -2056,8 +2056,11 @@ JitOptSymbol *arg; JitOptSymbol *res; arg = stack_pointer[-1]; - if (sym_has_type(arg)) { - res = sym_new_const(ctx, (PyObject *)sym_get_type(arg)); + PyObject* type = (PyObject *)sym_get_type(arg); + if (type) { + res = sym_new_const(ctx, type); + REPLACE_OP(this_instr, _POP_CALL_ONE_LOAD_CONST_INLINE_BORROW, 0, + (uintptr_t)type); } else { res = sym_new_not_null(ctx); |