gh-146381: Constant-fold frozendict subscript lookups via REPLACE_OPCODE_IF_EVALUATES_PURE (gh-146490)

This commit is contained in:
Donghee Na 2026-03-28 09:48:53 +09:00 committed by GitHub
parent a933e9ccee
commit 5992238986
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 86 additions and 1 deletions

View file

@ -485,6 +485,9 @@ dummy_func(void) {
res = sym_new_not_null(ctx);
ds = dict_st;
ss = sub_st;
if (sym_matches_type(dict_st, &PyFrozenDict_Type)) {
REPLACE_OPCODE_IF_EVALUATES_PURE(dict_st, sub_st, res);
}
}
op(_BINARY_OP_SUBSCR_LIST_SLICE, (list_st, sub_st -- res, ls, ss)) {