summaryrefslogtreecommitdiffstats
path: root/Tools/cases_generator/optimizer_generator.py
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2025-01-23 09:26:25 (GMT)
committerGitHub <noreply@github.com>2025-01-23 09:26:25 (GMT)
commita10f99375e7912df863cf101a38e9703cfcd72f1 (patch)
tree7909c7896fe256427c1149d2416fb7912ad3ba48 /Tools/cases_generator/optimizer_generator.py
parentd7d066c3ab6842117f9e0fb1c9dde4bce00fa1e3 (diff)
downloadcpython-a10f99375e7912df863cf101a38e9703cfcd72f1.zip
cpython-a10f99375e7912df863cf101a38e9703cfcd72f1.tar.gz
cpython-a10f99375e7912df863cf101a38e9703cfcd72f1.tar.bz2
Revert "GH-128914: Remove conditional stack effects from `bytecodes.c` and the code generators (GH-128918)" (GH-129202)
The commit introduced a ~2.5-3% regression in the free threading build. This reverts commit ab61d3f4303d14a413bc9ae6557c730ffdf7579e.
Diffstat (limited to 'Tools/cases_generator/optimizer_generator.py')
-rw-r--r--Tools/cases_generator/optimizer_generator.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Tools/cases_generator/optimizer_generator.py b/Tools/cases_generator/optimizer_generator.py
index 7ebeff7..5cfec4b 100644
--- a/Tools/cases_generator/optimizer_generator.py
+++ b/Tools/cases_generator/optimizer_generator.py
@@ -48,13 +48,19 @@ def declare_variables(uop: Uop, out: CWriter, skip_inputs: bool) -> None:
for var in reversed(uop.stack.inputs):
if var.used and var.name not in variables:
variables.add(var.name)
- out.emit(f"{type_name(var)}{var.name};\n")
+ if var.condition:
+ out.emit(f"{type_name(var)}{var.name} = NULL;\n")
+ else:
+ out.emit(f"{type_name(var)}{var.name};\n")
for var in uop.stack.outputs:
if var.peek:
continue
if var.name not in variables:
variables.add(var.name)
- out.emit(f"{type_name(var)}{var.name};\n")
+ if var.condition:
+ out.emit(f"{type_name(var)}{var.name} = NULL;\n")
+ else:
+ out.emit(f"{type_name(var)}{var.name};\n")
def decref_inputs(