From b329b2b28e2358d0dab7efcff72bb5678de05525 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Mon, 24 Dec 2018 17:10:36 +0100 Subject: [PATCH] Avoid a possibly unnecessary expansion When transforming if(!non-bool | !bool) to if(!(non-bool & -bool)), don't negate the bool if non-bool is actually an AND-bool. --- lslopt/lslfoldconst.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lslopt/lslfoldconst.py b/lslopt/lslfoldconst.py index 0bbe4b5..ed09e82 100644 --- a/lslopt/lslfoldconst.py +++ b/lslopt/lslfoldconst.py @@ -504,7 +504,7 @@ class foldconst(object): if not self.IsBool(child[b].ch[0]): a, b = 1, 0 if self.IsBool(child[b].ch[0]): - if not self.IsBool(child[a].ch[0]): + if not self.IsAndBool(child[a].ch[0]): child[b].ch[0] = nr(nt='NEG', t='integer', ch=[child[b].ch[0]])