Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,186 changes: 1,088 additions & 1,098 deletions Include/internal/pycore_uop_ids.h

Large diffs are not rendered by default.

64 changes: 0 additions & 64 deletions Include/internal/pycore_uop_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 12 additions & 16 deletions Lib/test/test_capi/test_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ def testfunc(n):
self.assertIsNotNone(ex)
uops = get_opnames(ex)
self.assertNotIn("_BINARY_OP_ADD_INT", uops)
self.assertNotIn("_POP_TWO_LOAD_CONST_INLINE_BORROW", uops)
self.assertNotIn("_POP_TWO", uops)
self.assertNotIn("_GUARD_NOS_INT", uops)
self.assertNotIn("_GUARD_TOS_INT", uops)

Expand Down Expand Up @@ -1808,7 +1808,6 @@ def testfunc(n):
self.assertIsNotNone(ex)
uops = get_opnames(ex)
self.assertNotIn("_UNARY_NEGATIVE", uops)
self.assertNotIn("_POP_TOP_LOAD_CONST_INLINE_BORROW", uops)

def test_unary_not_pop_top_load_const_inline_borrow(self):
def testfunc(n):
Expand All @@ -1827,9 +1826,9 @@ def testfunc(n):
self.assertNotIn("_UNARY_NOT", uops)
# TODO (gh-143723): After refactoring TO_BOOL_INT to eliminate redundant
# refcounts, 'not a' is now constant-folded and currently lowered to
# _POP_TOP_LOAD_CONST_INLINE_BORROW. Re-enable once constant folding
# avoids this fused pop+const uop.
# self.assertNotIn("_POP_TOP_LOAD_CONST_INLINE_BORROW", uops)
# _POP_TOP + _LOAD_CONST_INLINE_BORROW. Re-enable once constant folding
# avoids emitting these.
# self.assertNotIn("_LOAD_CONST_INLINE_BORROW", uops)

def test_unary_invert_insert_1_load_const_inline_borrow(self):
def testfunc(n):
Expand Down Expand Up @@ -1863,7 +1862,7 @@ def testfunc(n):
self.assertIsNotNone(ex)
uops = get_opnames(ex)
self.assertNotIn("_COMPARE_OP", uops)
self.assertNotIn("_POP_TWO_LOAD_CONST_INLINE_BORROW", uops)
self.assertNotIn("_POP_TWO", uops)

def test_compare_op_int_insert_two_load_const_inline_borrow(self):
def testfunc(n):
Expand All @@ -1880,7 +1879,7 @@ def testfunc(n):
self.assertIsNotNone(ex)
uops = get_opnames(ex)
self.assertNotIn("_COMPARE_OP_INT", uops)
self.assertIn("_INSERT_2_LOAD_CONST_INLINE_BORROW", uops)
self.assertIn("_LOAD_CONST_INLINE_BORROW", uops)

def test_compare_op_str_insert_two_load_const_inline_borrow(self):
def testfunc(n):
Expand All @@ -1897,7 +1896,7 @@ def testfunc(n):
self.assertIsNotNone(ex)
uops = get_opnames(ex)
self.assertNotIn("_COMPARE_OP_STR", uops)
self.assertIn("_INSERT_2_LOAD_CONST_INLINE_BORROW", uops)
self.assertIn("_LOAD_CONST_INLINE_BORROW", uops)

def test_compare_op_float_insert_two_load_const_inline_borrow(self):
def testfunc(n):
Expand All @@ -1914,7 +1913,7 @@ def testfunc(n):
self.assertIsNotNone(ex)
uops = get_opnames(ex)
self.assertNotIn("_COMPARE_OP_FLOAT", uops)
self.assertIn("_INSERT_2_LOAD_CONST_INLINE_BORROW", uops)
self.assertIn("_LOAD_CONST_INLINE_BORROW", uops)

def test_contains_op_pop_two_load_const_inline_borrow(self):
def testfunc(n):
Expand All @@ -1931,7 +1930,7 @@ def testfunc(n):
self.assertIsNotNone(ex)
uops = get_opnames(ex)
self.assertNotIn("_CONTAINS_OP", uops)
self.assertNotIn("_POP_TWO_LOAD_CONST_INLINE_BORROW", uops)
self.assertNotIn("_POP_TWO", uops)

def test_to_bool_bool_contains_op_set(self):
"""
Expand Down Expand Up @@ -2173,7 +2172,7 @@ def f(n):
uops = get_opnames(ex)
self.assertNotIn("_GUARD_TOS_ANY_SET", uops)
# _CONTAINS_OP_SET is constant-folded away for frozenset literals
self.assertIn("_INSERT_2_LOAD_CONST_INLINE_BORROW", uops)
self.assertIn("_LOAD_CONST_INLINE_BORROW", uops)

def test_remove_guard_for_known_type_tuple(self):
def f(n):
Expand Down Expand Up @@ -3010,7 +3009,6 @@ def testfunc(n):
self.assertNotIn("_CALL_ISINSTANCE", uops)
self.assertNotIn("_TO_BOOL_BOOL", uops)
self.assertNotIn(self.guard_is_true, uops)
self.assertNotIn("_POP_TOP_LOAD_CONST_INLINE_BORROW", uops)

def test_call_isinstance_is_false(self):
def testfunc(n):
Expand All @@ -3028,7 +3026,6 @@ def testfunc(n):
self.assertNotIn("_CALL_ISINSTANCE", uops)
self.assertNotIn("_TO_BOOL_BOOL", uops)
self.assertNotIn(self.guard_is_false, uops)
self.assertNotIn("_POP_TOP_LOAD_CONST_INLINE_BORROW", uops)

def test_call_isinstance_subclass(self):
def testfunc(n):
Expand All @@ -3046,7 +3043,6 @@ def testfunc(n):
self.assertNotIn("_CALL_ISINSTANCE", uops)
self.assertNotIn("_TO_BOOL_BOOL", uops)
self.assertNotIn(self.guard_is_true, uops)
self.assertNotIn("_POP_TOP_LOAD_CONST_INLINE_BORROW", uops)

def test_call_isinstance_unknown_object(self):
def testfunc(n):
Expand Down Expand Up @@ -4419,7 +4415,7 @@ def testfunc(n):
self.assertEqual(res, TIER2_THRESHOLD)
self.assertIsNotNone(ex)
uops = get_opnames(ex)
self.assertIn("_INSERT_2_LOAD_CONST_INLINE_BORROW", uops)
self.assertIn("_LOAD_CONST_INLINE_BORROW", uops)
self.assertNotIn("_BINARY_OP_SUBSCR_DICT", uops)

def test_binary_subscr_frozendict_const_fold(self):
Expand Down Expand Up @@ -4649,7 +4645,7 @@ def testfunc(*args):

self.assertIn("_LOAD_ATTR_PROPERTY_FRAME", uops)
# This is a sign the optimizer ran and didn't hit contradiction.
self.assertIn("_INSERT_2_LOAD_CONST_INLINE_BORROW", uops)
self.assertIn("_LOAD_CONST_INLINE_BORROW", uops)

def test_unary_negative(self):
def testfunc(n):
Expand Down
23 changes: 0 additions & 23 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -5906,11 +5906,6 @@ dummy_func(
value = PyStackRef_FromPyObjectNew(ptr);
}

tier2 pure op (_POP_TOP_LOAD_CONST_INLINE, (ptr/4, pop -- value)) {
PyStackRef_CLOSE(pop);
value = PyStackRef_FromPyObjectNew(ptr);
}

tier2 pure op(_LOAD_CONST_INLINE_BORROW, (ptr/4 -- value)) {
value = PyStackRef_FromPyObjectBorrow(ptr);
}
Expand All @@ -5936,24 +5931,6 @@ dummy_func(
PyStackRef_CLOSE(callable);
}

tier2 op(_POP_TOP_LOAD_CONST_INLINE_BORROW, (ptr/4, pop -- value)) {
PyStackRef_CLOSE(pop);
value = PyStackRef_FromPyObjectBorrow(ptr);
}

tier2 op(_POP_TWO_LOAD_CONST_INLINE_BORROW, (ptr/4, pop1, pop2 -- value)) {
PyStackRef_CLOSE(pop2);
PyStackRef_CLOSE(pop1);
value = PyStackRef_FromPyObjectBorrow(ptr);
}

tier2 op(_INSERT_2_LOAD_CONST_INLINE_BORROW, (ptr/4, left, right -- res, l, r)) {
res = PyStackRef_FromPyObjectBorrow(ptr);
l = left;
r = right;
INPUTS_DEAD();
}

tier2 op(_SHUFFLE_3_LOAD_CONST_INLINE_BORROW, (ptr/4, callable, null, arg -- res, a, c)) {
res = PyStackRef_FromPyObjectBorrow(ptr);
a = arg;
Expand Down
Loading
Loading