File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -664,7 +664,7 @@ bool simplify_exprt::simplify_bitwise(exprt &expr)
664664 result=false ;
665665 }
666666
667- // now erase zeros out of bitor, bitxor
667+ // now erase 'all zeros' out of bitor, bitxor
668668
669669 if (expr.id ()==ID_bitor || expr.id ()==ID_bitxor)
670670 {
@@ -683,6 +683,28 @@ bool simplify_exprt::simplify_bitwise(exprt &expr)
683683 }
684684 }
685685
686+ // now erase 'all ones' out of bitand
687+
688+ if (expr.id ()==ID_bitand)
689+ {
690+ for (exprt::operandst::iterator
691+ it=expr.operands ().begin ();
692+ it!=expr.operands ().end ();
693+ ) // no it++
694+ {
695+ if (it->is_constant () &&
696+ id2string (to_constant_expr (*it).get_value ()).find (' 0' )==
697+ std::string::npos &&
698+ expr.operands ().size ()>1 )
699+ {
700+ it=expr.operands ().erase (it);
701+ result=false ;
702+ }
703+ else
704+ it++;
705+ }
706+ }
707+
686708 // two operands that are syntactically the same
687709
688710 if (expr.operands ().size ()==2 &&
You can’t perform that action at this time.
0 commit comments