Skip to content

Commit 7563585

Browse files
authored
gh-148235: remove duplicate uops _LOAD_CONST_UNDER_INLINE(_BORROW) in JIT (GH-148236)
1 parent 8923ca4 commit 7563585

File tree

8 files changed

+1088
-1288
lines changed

8 files changed

+1088
-1288
lines changed

Include/internal/pycore_uop_ids.h

Lines changed: 1071 additions & 1079 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_metadata.h

Lines changed: 0 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Lib/test/test_capi/test_opt.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,7 @@ def testfunc(n):
18461846
self.assertIsNotNone(ex)
18471847
uops = get_opnames(ex)
18481848
self.assertNotIn("_UNARY_INVERT", uops)
1849-
self.assertIn("_INSERT_1_LOAD_CONST_INLINE_BORROW", uops)
1849+
self.assertIn("_LOAD_CONST_INLINE_BORROW", uops)
18501850

18511851
def test_compare_op_pop_two_load_const_inline_borrow(self):
18521852
def testfunc(n):
@@ -3192,8 +3192,8 @@ def f(n):
31923192
self.assertEqual(res, TIER2_THRESHOLD)
31933193
uops = get_opnames(ex)
31943194
self.assertNotIn("_LOAD_ATTR_METHOD_NO_DICT", uops)
3195-
self.assertNotIn("_LOAD_CONST_UNDER_INLINE", uops)
3196-
self.assertIn("_LOAD_CONST_UNDER_INLINE_BORROW", uops)
3195+
self.assertNotIn("_INSERT_1_LOAD_CONST_INLINE", uops)
3196+
self.assertIn("_INSERT_1_LOAD_CONST_INLINE_BORROW", uops)
31973197

31983198
def test_store_fast_refcount_elimination(self):
31993199
def foo(x):
@@ -4009,8 +4009,6 @@ class A:
40094009
self.assertIsNotNone(ex)
40104010
uops = get_opnames(ex)
40114011
self.assertNotIn("_REPLACE_WITH_TRUE", uops)
4012-
self.assertIn("_INSERT_1_LOAD_CONST_INLINE_BORROW", uops)
4013-
self.assertEqual(count_ops(ex, "_POP_TOP_NOP"), 1)
40144012

40154013
def test_attr_promotion_failure(self):
40164014
# We're not testing for any specific uops here, just

Python/bytecodes.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5965,18 +5965,6 @@ dummy_func(
59655965
value = PyStackRef_FromPyObjectBorrow(ptr);
59665966
}
59675967

5968-
tier2 op(_LOAD_CONST_UNDER_INLINE, (ptr/4, old -- value, new)) {
5969-
new = old;
5970-
DEAD(old);
5971-
value = PyStackRef_FromPyObjectNew(ptr);
5972-
}
5973-
5974-
tier2 op(_LOAD_CONST_UNDER_INLINE_BORROW, (ptr/4, old -- value, new)) {
5975-
new = old;
5976-
DEAD(old);
5977-
value = PyStackRef_FromPyObjectBorrow(ptr);
5978-
}
5979-
59805968
tier2 op(_START_EXECUTOR, (executor/4 --)) {
59815969
#ifndef _Py_JIT
59825970
assert(current_executor == (_PyExecutorObject*)executor);

Python/executor_cases.c.h

Lines changed: 0 additions & 114 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/optimizer_analysis.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,8 @@ const uint16_t op_without_push[MAX_UOP_ID + 1] = {
611611
[_COPY] = _NOP,
612612
[_LOAD_CONST_INLINE] = _NOP,
613613
[_LOAD_CONST_INLINE_BORROW] = _NOP,
614-
[_LOAD_CONST_UNDER_INLINE] = _POP_TOP_LOAD_CONST_INLINE,
615-
[_LOAD_CONST_UNDER_INLINE_BORROW] = _POP_TOP_LOAD_CONST_INLINE_BORROW,
614+
[_INSERT_1_LOAD_CONST_INLINE] = _POP_TOP_LOAD_CONST_INLINE,
615+
[_INSERT_1_LOAD_CONST_INLINE_BORROW] = _POP_TOP_LOAD_CONST_INLINE_BORROW,
616616
[_LOAD_FAST] = _NOP,
617617
[_LOAD_FAST_BORROW] = _NOP,
618618
[_LOAD_SMALL_INT] = _NOP,

Python/optimizer_bytecodes.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -925,8 +925,8 @@ dummy_func(void) {
925925
PyTypeObject *type = sym_get_type(owner);
926926
PyObject *name = get_co_name(ctx, oparg >> 1);
927927
attr = lookup_attr(ctx, dependencies, this_instr, type, name,
928-
_LOAD_CONST_UNDER_INLINE_BORROW,
929-
_LOAD_CONST_UNDER_INLINE);
928+
_INSERT_1_LOAD_CONST_INLINE_BORROW,
929+
_INSERT_1_LOAD_CONST_INLINE);
930930
self = owner;
931931
}
932932

@@ -935,8 +935,8 @@ dummy_func(void) {
935935
PyTypeObject *type = sym_get_type(owner);
936936
PyObject *name = get_co_name(ctx, oparg >> 1);
937937
attr = lookup_attr(ctx, dependencies, this_instr, type, name,
938-
_LOAD_CONST_UNDER_INLINE_BORROW,
939-
_LOAD_CONST_UNDER_INLINE);
938+
_INSERT_1_LOAD_CONST_INLINE_BORROW,
939+
_INSERT_1_LOAD_CONST_INLINE);
940940
self = owner;
941941
}
942942

@@ -945,8 +945,8 @@ dummy_func(void) {
945945
PyTypeObject *type = sym_get_type(owner);
946946
PyObject *name = get_co_name(ctx, oparg >> 1);
947947
attr = lookup_attr(ctx, dependencies, this_instr, type, name,
948-
_LOAD_CONST_UNDER_INLINE_BORROW,
949-
_LOAD_CONST_UNDER_INLINE);
948+
_INSERT_1_LOAD_CONST_INLINE_BORROW,
949+
_INSERT_1_LOAD_CONST_INLINE);
950950
self = owner;
951951
}
952952

Python/optimizer_cases.c.h

Lines changed: 6 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)