https://github.com/python/cpython/commit/3d8fc06d4f8dc1e7be2455a7e89b37285fa89112
commit: 3d8fc06d4f8dc1e7be2455a7e89b37285fa89112
branch: main
author: Ken Jin <[email protected]>
committer: Fidget-Spinner <[email protected]>
date: 2024-02-23T18:43:52Z
summary:
gh-115859: Disable the tier 2 redundancy eliminator by default (GH-115860)
files:
M Lib/test/test_capi/test_opt.py
M Python/optimizer_analysis.c
diff --git a/Lib/test/test_capi/test_opt.py b/Lib/test/test_capi/test_opt.py
index 38c6fa4b47d0c9..25fc36dec93ddc 100644
--- a/Lib/test/test_capi/test_opt.py
+++ b/Lib/test/test_capi/test_opt.py
@@ -4,6 +4,7 @@
import textwrap
import unittest
import gc
+import os
import _testinternalcapi
@@ -568,6 +569,8 @@ def testfunc(n):
count = ops.count("_GUARD_IS_TRUE_POP") +
ops.count("_GUARD_IS_FALSE_POP")
self.assertLessEqual(count, 2)
+
[email protected](os.getenv("PYTHONUOPSOPTIMIZE", default=0) == 0, "Needs uop
optimizer to run.")
class TestUopsOptimization(unittest.TestCase):
def _run_with_optimizer(self, testfunc, arg):
diff --git a/Python/optimizer_analysis.c b/Python/optimizer_analysis.c
index 9503dcc74656cd..47bfc8cf1061d9 100644
--- a/Python/optimizer_analysis.c
+++ b/Python/optimizer_analysis.c
@@ -810,9 +810,12 @@ _Py_uop_analyze_and_optimize(
peephole_opt(frame, buffer, buffer_size);
- err = uop_redundancy_eliminator(
- (PyCodeObject *)frame->f_executable, buffer,
- buffer_size, curr_stacklen, dependencies);
+ char *uop_optimize = Py_GETENV("PYTHONUOPSOPTIMIZE");
+ if (uop_optimize != NULL && *uop_optimize > '0') {
+ err = uop_redundancy_eliminator(
+ (PyCodeObject *)frame->f_executable, buffer,
+ buffer_size, curr_stacklen, dependencies);
+ }
if (err == 0) {
goto not_ready;
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]