@@ -191,6 +191,7 @@ def replace_opcode_if_evaluates_pure(
191191 input_identifiers_as_str = {tkn .text for tkn in input_identifiers }
192192 used_stack_inputs = [inp for inp in uop .stack .inputs if inp .name in input_identifiers_as_str ]
193193 assert len (used_stack_inputs ) > 0
194+ self .out .start_line ()
194195 emitter = OptimizerConstantEmitter (self .out , {}, self .original_uop , self .stack .copy ())
195196 emitter .emit ("if (\n " )
196197 for inp in used_stack_inputs [:- 1 ]:
@@ -247,14 +248,14 @@ def replace_opcode_if_evaluates_pure(
247248 if input_count in input_count_to_uop :
248249 replacement_uop = input_count_to_uop [input_count ]
249250 input_desc = "one input" if input_count == 1 else "two inputs"
250- emitter . emit (
251- f""" if (sym_is_const(ctx, { outp .name } )) {{
252- PyObject *result = sym_get_const(ctx, { outp .name } );
253- if (_Py_IsImmortal(result)) {{
254- // Replace with { replacement_uop } since we have { input_desc } and an immortal result
255- REPLACE_OP(this_instr, { replacement_uop } , 0, (uintptr_t)result);
256- }}
257- }}"" " )
251+
252+ emitter . emit ( f" if (sym_is_const(ctx, { outp .name } )) {{\n " )
253+ emitter . emit ( f" PyObject *result = sym_get_const(ctx, { outp .name } );\n " )
254+ emitter . emit ( f" if (_Py_IsImmortal(result)) {{\n " )
255+ emitter . emit ( f" // Replace with { replacement_uop } since we have { input_desc } and an immortal result\n " )
256+ emitter . emit ( f" REPLACE_OP(this_instr, { replacement_uop } , 0, (uintptr_t)result);\n " )
257+ emitter . emit ( "} \n " )
258+ emitter . emit ( "} \n " )
258259
259260 storage .flush (self .out )
260261 emitter .emit ("break;\n " )
0 commit comments