File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2880,6 +2880,25 @@ def testfunc(n):
28802880 self .assertIn ("_POP_TOP_NOP" , uops )
28812881 self .assertLessEqual (count_ops (ex , "_POP_TOP" ), 2 )
28822882
2883+ def test_binary_op_extend_float_long_add_refcount_elimination (self ):
2884+ def testfunc (n ):
2885+ a = 1.5
2886+ b = 2
2887+ res = 0.0
2888+ for _ in range (n ):
2889+ res = a + b
2890+ return res
2891+
2892+ res , ex = self ._run_with_optimizer (testfunc , TIER2_THRESHOLD )
2893+ self .assertEqual (res , 3.5 )
2894+ self .assertIsNotNone (ex )
2895+ uops = get_opnames (ex )
2896+ for uop in uops :
2897+ print (uop )
2898+ self .assertIn ("_BINARY_OP_EXTEND" , uops )
2899+ self .assertIn ("_POP_TOP_NOP" , uops )
2900+ self .assertLessEqual (count_ops (ex , "_POP_TOP" ), 2 )
2901+
28832902 def test_remove_guard_for_slice_list (self ):
28842903 def f (n ):
28852904 for i in range (n ):
You can’t perform that action at this time.
0 commit comments