@@ -1441,19 +1441,19 @@ def test_narrow_type_to_constant_int_zero(self):
14411441 def f (n ):
14421442 trace = []
14431443 for i in range (n ):
1444- # f is always (int) 0, but we can only prove that it's a integer:
1445- f = i - i # at this point python knows f is an int, but doesnt know that it is 0 (we know it is 0 though)
1444+ # zero is always (int) 0, but we can only prove that it's a integer:
1445+ zero = i - i # at this point python knows f is an int, but doesnt know that it is 0 (we know it is 0 though)
14461446 trace .append ("A" )
1447- if not f : # Kept.
1447+ if not zero : # Kept.
14481448 trace .append ("B" )
1449- if not f : # Removed!
1449+ if not zero : # Removed!
14501450 trace .append ("C" )
14511451 trace .append ("D" )
1452- if f : # Removed!
1452+ if zero : # Removed!
14531453 trace .append ("X" )
14541454 trace .append ("E" )
14551455 trace .append ("F" )
1456- if f : # Removed!
1456+ if zero : # Removed!
14571457 trace .append ("X" )
14581458 trace .append ("G" )
14591459 return trace
@@ -1468,36 +1468,6 @@ def f(n):
14681468 # But all of the appends we care about are still there:
14691469 self .assertEqual (uops .count ("_CALL_LIST_APPEND" ), len ("ABCDEFG" ))
14701470
1471- # def test_narrow_type_to_constant_bool_true(self):
1472- # def f(n):
1473- # trace = []
1474- # for i in range(n):
1475- # # f is always True, but we can only prove that it's a bool:
1476- # f = i != TIER2_THRESHOLD
1477- # trace.append("A")
1478- # if f: # Kept.
1479- # trace.append("B")
1480- # if not f: # Removed!
1481- # trace.append("X")
1482- # trace.append("C")
1483- # if f: # Removed!
1484- # trace.append("D")
1485- # trace.append("E")
1486- # trace.append("F")
1487- # if not f: # Removed!
1488- # trace.append("X")
1489- # trace.append("G")
1490- # return trace
1491-
1492- # trace, ex = self._run_with_optimizer(f, TIER2_THRESHOLD)
1493- # self.assertEqual(trace, list("ABCDEFG") * TIER2_THRESHOLD)
1494- # self.assertIsNotNone(ex)
1495- # uops = get_opnames(ex)
1496- # # Only one guard remains:
1497- # self.assertEqual(uops.count("_GUARD_IS_FALSE_POP"), 0)
1498- # self.assertEqual(uops.count("_GUARD_IS_TRUE_POP"), 1)
1499- # # But all of the appends we care about are still there:
1500- # self.assertEqual(uops.count("_CALL_LIST_APPEND"), len("ABCDEFG"))
15011471
15021472def global_identity (x ):
15031473 return x
0 commit comments