From 8d337467cb5501dd35e3ec860ec006be48fd8acc Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Tue, 17 Oct 2017 23:25:26 +0200 Subject: [PATCH] Fold the children of | as conditions when | is folded as condition. --- lslopt/lslfoldconst.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lslopt/lslfoldconst.py b/lslopt/lslfoldconst.py index 5310383..09bf643 100644 --- a/lslopt/lslfoldconst.py +++ b/lslopt/lslfoldconst.py @@ -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))