GH-131798: Optimize away type(x) in the JIT when the result is known (GH-135194)
This commit is contained in:
7
Python/optimizer_cases.c.h
generated
7
Python/optimizer_cases.c.h
generated
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user