gh-145866: Convert _CALL_INTRINSIC_2 to leave its inputs on the stack to be cleaned up by _POP_TOP (GH-146262)

This commit is contained in:
Kevin Huai 2026-03-26 03:41:07 -06:00 committed by GitHub
parent 495178ab05
commit f5364ae750
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 1346 additions and 1283 deletions

View file

@ -2699,6 +2699,22 @@ def testfunc(n):
self.assertEqual(count_ops(ex, "_POP_TOP_NOP"), 1)
self.assertLessEqual(count_ops(ex, "_POP_TOP"), 2)
def test_call_intrinsic_2(self):
def testfunc(n):
x = 0
for _ in range(n):
def test_testfunc[T](n):
pass
return x
res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD)
self.assertEqual(res, 0)
uops = get_opnames(ex)
self.assertIn("_CALL_INTRINSIC_2", uops)
self.assertGreaterEqual(count_ops(ex, "_POP_TOP_NOP"), 2)
self.assertLessEqual(count_ops(ex, "_POP_TOP"), 4)
def test_get_len_with_const_tuple(self):
def testfunc(n):
x = 0.0