mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
gh-130480: Move duplicate LOAD_SMALL_INT
optimization from codegen to CFG (#130481)
This commit is contained in:
parent
26511993e6
commit
55815a6474
6 changed files with 146 additions and 116 deletions
|
@ -282,14 +282,6 @@ codegen_addop_noarg(instr_sequence *seq, int opcode, location loc)
|
|||
static int
|
||||
codegen_addop_load_const(compiler *c, location loc, PyObject *o)
|
||||
{
|
||||
if (PyLong_CheckExact(o)) {
|
||||
int overflow;
|
||||
long val = PyLong_AsLongAndOverflow(o, &overflow);
|
||||
if (!overflow && _PY_IS_SMALL_INT(val)) {
|
||||
ADDOP_I(c, loc, LOAD_SMALL_INT, val);
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
Py_ssize_t arg = _PyCompile_AddConst(c, o);
|
||||
if (arg < 0) {
|
||||
return ERROR;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue