Do constant folding for boolean operations.