Skip to content

Commit e24e9a3

Browse files
Fix test_opt
1 parent 4c0c52c commit e24e9a3

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

Python/optimizer_bytecodes.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,16 +239,28 @@ dummy_func(void) {
239239
op(_BINARY_OP_ADD_FLOAT, (left, right -- res)) {
240240
REPLACE_OPCODE_IF_EVALUATES_PURE(left, right);
241241
res = sym_new_type(ctx, &PyFloat_Type);
242+
// TODO (gh-134584): Refactor this to use another uop
243+
if (PyJitRef_IsBorrowed(left) && PyJitRef_IsBorrowed(right)) {
244+
REPLACE_OP(this_instr, op_without_decref_inputs[opcode], oparg, 0);
245+
}
242246
}
243247

244248
op(_BINARY_OP_SUBTRACT_FLOAT, (left, right -- res)) {
245249
REPLACE_OPCODE_IF_EVALUATES_PURE(left, right);
246250
res = sym_new_type(ctx, &PyFloat_Type);
251+
// TODO (gh-134584): Refactor this to use another uop
252+
if (PyJitRef_IsBorrowed(left) && PyJitRef_IsBorrowed(right)) {
253+
REPLACE_OP(this_instr, op_without_decref_inputs[opcode], oparg, 0);
254+
}
247255
}
248256

249257
op(_BINARY_OP_MULTIPLY_FLOAT, (left, right -- res)) {
250258
REPLACE_OPCODE_IF_EVALUATES_PURE(left, right);
251259
res = sym_new_type(ctx, &PyFloat_Type);
260+
// TODO (gh-134584): Refactor this to use another uop
261+
if (PyJitRef_IsBorrowed(left) && PyJitRef_IsBorrowed(right)) {
262+
REPLACE_OP(this_instr, op_without_decref_inputs[opcode], oparg, 0);
263+
}
252264
}
253265

254266
op(_BINARY_OP_ADD_UNICODE, (left, right -- res)) {

Python/optimizer_cases.c.h

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

0 commit comments

Comments
 (0)