Fold the children of | as conditions when | is folded as condition.

This commit is contained in:
Sei Lisa 2017-10-17 23:25:26 +02:00
parent a6a16c6e8f
commit 8d337467cb

View file

@ -245,6 +245,11 @@ class foldconst(object):
self.FoldCond(parent, index, ParentIsNegation)
return
if nt == '|':
# In FoldCond(a | b), both a and b are conds themselves.
self.FoldCond(child, 0)
self.FoldCond(child, 1)
# Specific optimization to catch a bitwise test appearing frequently.
# If b and c are nonzero constant powers of two:
# !(a & b) | !(a & c) -> ~(a|~(b|c))