Fold the children of | as conditions when | is folded as condition.
This commit is contained in:
@@ -245,6 +245,11 @@ class foldconst(object):
|
|||||||
self.FoldCond(parent, index, ParentIsNegation)
|
self.FoldCond(parent, index, ParentIsNegation)
|
||||||
return
|
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.
|
# Specific optimization to catch a bitwise test appearing frequently.
|
||||||
# If b and c are nonzero constant powers of two:
|
# If b and c are nonzero constant powers of two:
|
||||||
# !(a & b) | !(a & c) -> ~(a|~(b|c))
|
# !(a & b) | !(a & c) -> ~(a|~(b|c))
|
||||||
|
|||||||
Reference in New Issue
Block a user