@@ -210,9 +210,6 @@ void custom_bitvector_domaint::transform(
210210 ai_baset &ai,
211211 const namespacet &ns)
212212{
213- if (has_values.is_false ())
214- return ;
215-
216213 // upcast of ai
217214 custom_bitvector_analysist &cba=
218215 static_cast <custom_bitvector_analysist &>(ai);
@@ -484,44 +481,55 @@ bool custom_bitvector_domaint::merge(
484481 locationt from,
485482 locationt to)
486483{
487- if (b.has_values .is_false ())
488- return false ; // no change
489-
490- if (has_values.is_false ())
491- {
492- *this =b;
493- return true ; // change
494- }
495-
496- bool changed=false ;
484+ bool changed=has_values.is_false ();
485+ has_values=tvt::unknown ();
497486
498487 // first do MAY
499- for (const auto &bit : may_bits)
488+ bitst::iterator it=may_bits.begin ();
489+ for (const auto &bit : b.may_bits )
500490 {
501- bit_vectort &a_bits=may_bits[bit.first ];
502- bit_vectort old=a_bits;
503- a_bits|=bit.second ;
504- if (old!=a_bits)
491+ while (it!=may_bits.end () && it->first <bit.first )
492+ ++it;
493+ if (it==may_bits.end () || bit.first <it->first )
494+ {
495+ may_bits.insert (it, bit);
505496 changed=true ;
497+ }
498+ else if (it!=may_bits.end ())
499+ {
500+ bit_vectort &a_bits=it->second ;
501+ bit_vectort old=a_bits;
502+ a_bits|=bit.second ;
503+ if (old!=a_bits)
504+ changed=true ;
505+
506+ ++it;
507+ }
506508 }
507509
508510 // now do MUST
509- for (auto &bit : must_bits)
511+ it=must_bits.begin ();
512+ for (auto &bit : b.must_bits )
510513 {
511- bitst::const_iterator b_it=
512- b.must_bits .find (bit.first );
513-
514- if (b_it==b.must_bits .end ())
514+ while (it!=must_bits.end () && it->first <bit.first )
515515 {
516- bit. second = 0 ;
516+ it=must_bits. erase (it) ;
517517 changed=true ;
518518 }
519- else
519+ if (it==must_bits. end () || bit. first <it-> first )
520520 {
521- bit_vectort old=bit.second ;
522- bit.second &=bit.second ;
523- if (old!=bit.second )
521+ must_bits.insert (it, bit);
522+ changed=true ;
523+ }
524+ else if (it!=must_bits.end ())
525+ {
526+ bit_vectort &a_bits=it->second ;
527+ bit_vectort old=a_bits;
528+ a_bits&=bit.second ;
529+ if (old!=a_bits)
524530 changed=true ;
531+
532+ ++it;
525533 }
526534 }
527535
0 commit comments