Commit 3ee23f4f authored by Robert Bradshaw's avatar Robert Bradshaw

Directive for overflow folding.

parent 7e1b07cc
...@@ -8048,6 +8048,7 @@ class NumBinopNode(BinopNode): ...@@ -8048,6 +8048,7 @@ class NumBinopNode(BinopNode):
and not self.operand2.has_constant_result()): and not self.operand2.has_constant_result()):
self.operand1, self.operand2 = self.operand2, self.operand1 self.operand1, self.operand2 = self.operand2, self.operand1
self.overflow_check = True self.overflow_check = True
self.overflow_fold = env.directives['overflowcheck.fold']
self.func = self.type.overflow_check_binop( self.func = self.type.overflow_check_binop(
self.overflow_op_names[self.operator], self.overflow_op_names[self.operator],
env, env,
......
...@@ -3265,7 +3265,7 @@ class ConsolidateOverflowCheck(Visitor.CythonTransform): ...@@ -3265,7 +3265,7 @@ class ConsolidateOverflowCheck(Visitor.CythonTransform):
return node return node
def visit_NumBinopNode(self, node): def visit_NumBinopNode(self, node):
if node.overflow_check: if node.overflow_check and node.overflow_fold:
top_level_overflow = self.overflow_bit_node is None top_level_overflow = self.overflow_bit_node is None
if top_level_overflow: if top_level_overflow:
self.overflow_bit_node = node self.overflow_bit_node = node
......
...@@ -82,6 +82,7 @@ directive_defaults = { ...@@ -82,6 +82,7 @@ directive_defaults = {
'cdivision': False, # was True before 0.12 'cdivision': False, # was True before 0.12
'cdivision_warnings': False, 'cdivision_warnings': False,
'overflowcheck': False, 'overflowcheck': False,
'overflowcheck.fold': True,
'always_allow_keywords': False, 'always_allow_keywords': False,
'allow_none_for_extension_args': True, 'allow_none_for_extension_args': True,
'wraparound' : True, 'wraparound' : True,
......
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