@@ -210,9 +210,6 @@ void custom_bitvector_domaint::transform(
210
210
ai_baset &ai,
211
211
const namespacet &ns)
212
212
{
213
- if (has_values.is_false ())
214
- return ;
215
-
216
213
// upcast of ai
217
214
custom_bitvector_analysist &cba=
218
215
static_cast <custom_bitvector_analysist &>(ai);
@@ -484,44 +481,55 @@ bool custom_bitvector_domaint::merge(
484
481
locationt from,
485
482
locationt to)
486
483
{
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 ();
497
486
498
487
// 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 )
500
490
{
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);
505
496
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
+ }
506
508
}
507
509
508
510
// now do MUST
509
- for (auto &bit : must_bits)
511
+ it=must_bits.begin ();
512
+ for (auto &bit : b.must_bits )
510
513
{
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 )
515
515
{
516
- bit. second = 0 ;
516
+ it=must_bits. erase (it) ;
517
517
changed=true ;
518
518
}
519
- else
519
+ if (it==must_bits. end () || bit. first <it-> first )
520
520
{
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)
524
530
changed=true ;
531
+
532
+ ++it;
525
533
}
526
534
}
527
535
0 commit comments