Commit a9b16e3b authored by Mark Florisson's avatar Mark Florisson

Remove manual branch pruning

parent b55b3b0f
...@@ -1887,36 +1887,9 @@ class ReplaceFusedTypeChecks(VisitorTransform): ...@@ -1887,36 +1887,9 @@ class ReplaceFusedTypeChecks(VisitorTransform):
from Cython.Compiler import Optimize from Cython.Compiler import Optimize
self.visitchildren(node) self.visitchildren(node)
transform = Optimize.ConstantFolding()
if_clauses = [] transform.check_constant_value_not_set = False
seen_true = False return transform(node)
seen_true_anywhere = False
for if_clause in node.if_clauses:
transform = Optimize.ConstantFolding()
transform.check_constant_value_not_set = False
transform(if_clause.condition)
is_const = if_clause.condition.has_constant_result()
const = if_clause.condition.constant_result
if is_const:
if const and not seen_true:
seen_true = True
seen_true_anywhere = True
if_clauses.append(if_clause)
else:
seen_true = False
if_clauses.append(if_clause)
if if_clauses:
node.if_clauses = if_clauses
if seen_true_anywhere:
node.else_clause = None
else:
node = node.else_clause
return node
def visit_PrimaryCmpNode(self, node): def visit_PrimaryCmpNode(self, node):
type1 = node.operand1.analyse_as_type(self.local_scope) type1 = node.operand1.analyse_as_type(self.local_scope)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment