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)
664
664
result=false ;
665
665
}
666
666
667
- // now erase zeros out of bitor, bitxor
667
+ // now erase 'all zeros' out of bitor, bitxor
668
668
669
669
if (expr.id ()==ID_bitor || expr.id ()==ID_bitxor)
670
670
{
@@ -683,6 +683,28 @@ bool simplify_exprt::simplify_bitwise(exprt &expr)
683
683
}
684
684
}
685
685
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
+
686
708
// two operands that are syntactically the same
687
709
688
710
if (expr.operands ().size ()==2 &&
You can’t perform that action at this time.
0 commit comments