mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
gh-126835: Move constant subscript folding to CFG (#129568)
Move folding of constant subscription from AST optimizer to CFG. Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
This commit is contained in:
parent
bb5c6875d6
commit
0664c1af9b
6 changed files with 138 additions and 31 deletions
|
@ -284,7 +284,7 @@ codegen_addop_load_const(compiler *c, location loc, PyObject *o)
|
|||
if (PyLong_CheckExact(o)) {
|
||||
int overflow;
|
||||
long val = PyLong_AsLongAndOverflow(o, &overflow);
|
||||
if (!overflow && val >= 0 && val < 256 && val < _PY_NSMALLPOSINTS) {
|
||||
if (!overflow && _PY_IS_SMALL_INT(val)) {
|
||||
ADDOP_I(c, loc, LOAD_SMALL_INT, val);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue