aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test
diff options
context:
space:
mode:
authorNadeshiko Manju <me@manjusaka.me>2025-05-22 21:54:57 +0800
committerGitHub <noreply@github.com>2025-05-22 09:54:57 -0400
commit8c5e5557c64a8d6310b2a958f576d5eb245cb1b6 (patch)
treeb62a68f174604b362971d5f6c28accf174561f31 /Lib/test
parent3effede97cc13fc0c5ab5dcde26cc319f388e84c (diff)
downloadcpython-8c5e5557c64a8d6310b2a958f576d5eb245cb1b6.tar.gz
cpython-8c5e5557c64a8d6310b2a958f576d5eb245cb1b6.zip
GH-131798: Turn _LOAD_SMALL_INT into _LOAD_CONST_INLINE_BORROW in the JIT (GH-134406)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_capi/test_opt.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_capi/test_opt.py b/Lib/test/test_capi/test_opt.py
index 98b434313e4..2b777acb1ec 100644
--- a/Lib/test/test_capi/test_opt.py
+++ b/Lib/test/test_capi/test_opt.py
@@ -2156,6 +2156,18 @@ class TestUopsOptimization(unittest.TestCase):
self.assertIn("_GUARD_TYPE_VERSION", uops)
self.assertNotIn("_CHECK_ATTR_CLASS", uops)
+ def test_load_small_int(self):
+ def testfunc(n):
+ x = 0
+ for i in range(n):
+ x += 1
+ return x
+ res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD)
+ self.assertEqual(res, TIER2_THRESHOLD)
+ self.assertIsNotNone(ex)
+ uops = get_opnames(ex)
+ self.assertNotIn("_LOAD_SMALL_INT", uops)
+ self.assertIn("_LOAD_CONST_INLINE_BORROW", uops)
def global_identity(x):
return x