File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -1207,6 +1207,36 @@ def test_loop_quicken(self):
12071207 expected = dis_loop_test_quickened_code
12081208 self .do_disassembly_compare (got , expected )
12091209
1210+ @cpython_only
1211+ @requires_specialization
1212+ def test_loop_with_conditional_at_end_is_quickened (self ):
1213+ def for_loop_true (x ):
1214+ for i in range (10 ):
1215+ if x :
1216+ pass
1217+
1218+ for_loop_true (True )
1219+ self .assertIn ('FOR_ITER_RANGE' ,
1220+ self .get_disassembly (for_loop_true , adaptive = True ))
1221+
1222+ def for_loop_false (x ):
1223+ for i in range (10 ):
1224+ if x :
1225+ pass
1226+
1227+ for_loop_false (False )
1228+ self .assertIn ('FOR_ITER_RANGE' ,
1229+ self .get_disassembly (for_loop_false , adaptive = True ))
1230+
1231+ def while_loop ():
1232+ i = 0
1233+ while i < 10 :
1234+ i += 1
1235+
1236+ while_loop ()
1237+ self .assertIn ('COMPARE_OP_INT' ,
1238+ self .get_disassembly (while_loop , adaptive = True ))
1239+
12101240 @cpython_only
12111241 def test_extended_arg_quick (self ):
12121242 got = self .get_disassembly (extended_arg_quick )
You can’t perform that action at this time.
0 commit comments