projects
/
platform
/
upstream
/
python-cython.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b5e7706
)
discard ExprStatNodes with constant expressions
author
Stefan Behnel
<stefan_ml@behnel.de>
Sun, 8 Dec 2013 10:15:59 +0000
(11:15 +0100)
committer
Stefan Behnel
<stefan_ml@behnel.de>
Sun, 8 Dec 2013 10:15:59 +0000
(11:15 +0100)
Cython/Compiler/Optimize.py
patch
|
blob
|
history
diff --git
a/Cython/Compiler/Optimize.py
b/Cython/Compiler/Optimize.py
index
27a10d9
..
d1a53d6
100644
(file)
--- a/
Cython/Compiler/Optimize.py
+++ b/
Cython/Compiler/Optimize.py
@@
-3402,6
+3402,13
@@
class ConstantFolding(Visitor.VisitorTransform, SkipDeclarations):
return node
return None
+ def visit_ExprStatNode(self, node):
+ self.visitchildren(node)
+ # drop unused constant expressions
+ if node.expr.has_constant_result():
+ return None
+ return node
+
# in the future, other nodes can have their own handler method here
# that can replace them with a constant result node