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.
This commit is contained in:
Sei Lisa 2018-12-24 17:10:36 +01:00
parent c9f73bd429
commit b329b2b28e

View file

@ -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]])