Skip to content

Commit 634ed26

Browse files
Add for _BINARY_OP
1 parent 2644cb9 commit 634ed26

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

Python/optimizer_bytecodes.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ dummy_func(void) {
181181
}
182182

183183
op(_BINARY_OP, (lhs, rhs -- res)) {
184+
REPLACE_OPCODE_IF_EVALUATES_PURE(lhs, rhs);
184185
bool lhs_int = sym_matches_type(lhs, &PyLong_Type);
185186
bool rhs_int = sym_matches_type(rhs, &PyLong_Type);
186187
bool lhs_float = sym_matches_type(lhs, &PyFloat_Type);

Python/optimizer_cases.c.h

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

Tools/cases_generator/optimizer_generator.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,6 @@ def replace_opcode_if_evaluates_pure(
170170
) -> bool:
171171
skip_to(tkn_iter, "SEMI")
172172

173-
if self.original_uop.properties.escapes:
174-
raise analysis_error(
175-
f"REPLACE_OPCODE_IF_EVALUATES_PURE cannot be used with an escaping uop {self.original_uop.properties.escaping_calls}",
176-
self.original_uop.body.open
177-
)
178173
emitter = OptimizerConstantEmitter(self.out, {}, self.original_uop, copy.deepcopy(self.stack))
179174
emitter.emit("if (\n")
180175
assert isinstance(uop, Uop)

0 commit comments

Comments
 (0)