Skip to content
Merged
Prev Previous commit
Next Next commit
Update remove_unneeded_uops with new uops
  • Loading branch information
tomasr8 committed Jun 23, 2025
commit 6934f633a41378d010b4236f64a2535c9ebeafb9
3 changes: 2 additions & 1 deletion Lib/test/test_capi/test_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1819,9 +1819,10 @@ def testfunc(n):
self.assertIsNotNone(ex)
uops = get_opnames(ex)
# When the result of type(...) is known, _CALL_TYPE_1 is replaced with
# _POP_CALL_ONE_LOAD_CONST_INLINE_BORROW which is optimized away in
# _SWAP_CALL_ONE_LOAD_CONST_INLINE_BORROW which is optimized away in
# remove_unneeded_uops.
self.assertNotIn("_CALL_TYPE_1", uops)
self.assertNotIn("_SWAP_CALL_ONE_LOAD_CONST_INLINE_BORROW", uops)
self.assertNotIn("_POP_CALL_ONE_LOAD_CONST_INLINE_BORROW", uops)
self.assertNotIn("_POP_CALL_LOAD_CONST_INLINE_BORROW", uops)
self.assertNotIn("_POP_TOP_LOAD_CONST_INLINE_BORROW", uops)
Expand Down
6 changes: 6 additions & 0 deletions Python/optimizer_analysis.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,9 @@ const uint16_t op_without_push[MAX_UOP_ID + 1] = {
[_POP_TOP_LOAD_CONST_INLINE] = _POP_TOP,
[_POP_TOP_LOAD_CONST_INLINE_BORROW] = _POP_TOP,
[_POP_TWO_LOAD_CONST_INLINE_BORROW] = _POP_TWO,
[_POP_CALL_ONE_LOAD_CONST_INLINE_BORROW] = _POP_CALL_ONE,
[_POP_CALL_TWO_LOAD_CONST_INLINE_BORROW] = _POP_CALL_TWO,
[_SWAP_CALL_ONE_LOAD_CONST_INLINE_BORROW] = _POP_CALL_ONE_LOAD_CONST_INLINE_BORROW,
};

const bool op_skip[MAX_UOP_ID + 1] = {
Expand All @@ -578,6 +580,10 @@ const bool op_skip[MAX_UOP_ID + 1] = {

const uint16_t op_without_pop[MAX_UOP_ID + 1] = {
[_POP_TOP] = _NOP,
[_POP_TOP_NOP] = _NOP,
[_POP_TOP_INT] = _NOP,
[_POP_TOP_FLOAT] = _NOP,
[_POP_TOP_UNICODE] = _NOP,
[_POP_TOP_LOAD_CONST_INLINE] = _LOAD_CONST_INLINE,
[_POP_TOP_LOAD_CONST_INLINE_BORROW] = _LOAD_CONST_INLINE_BORROW,
[_POP_TWO] = _POP_TOP,
Expand Down
Loading