File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -2540,6 +2540,25 @@ def f(n):
25402540 self .assertNotIn ("_LOAD_ATTR_METHOD_NO_DICT" , uops )
25412541 self .assertNotIn ("_LOAD_ATTR_METHOD_LAZY_DICT" , uops )
25422542
2543+ def test_store_fast_refcount_elimination (self ):
2544+ def foo (x ):
2545+ # Since x is known to be
2546+ # a constant value (1) here,
2547+ # The refcount is eliminated in the STOER_FAST.
2548+ x = 2
2549+ return x
2550+ def testfunc (n ):
2551+ # The STORE_FAST for the range here needs a POP_TOP
2552+ # (for now, until we do loop peeling).
2553+ for _ in range (n ):
2554+ foo (1 )
2555+
2556+ res , ex = self ._run_with_optimizer (testfunc , TIER2_THRESHOLD )
2557+ self .assertIsNotNone (ex )
2558+ uops = get_opnames (ex )
2559+ self .assertIn ("_POP_TOP_NOP" , uops )
2560+ self .assertLessEqual (len (matching_opnames (ex , "_POP_TOP" )), 1 )
2561+
25432562 def test_float_op_refcount_elimination (self ):
25442563 def testfunc (args ):
25452564 a , b , n = args
You can’t perform that action at this time.
0 commit comments