@@ -651,16 +651,22 @@ pub trait BottomValue {
651
651
652
652
/// Merges `in_set` into `inout_set`, returning `true` if `inout_set` changed.
653
653
///
654
- /// You usually don't need to override this, since it automatically applies
654
+ /// It is almost certainly wrong to override this, since it automatically applies
655
655
/// * `inout_set & in_set` if `BOTTOM_VALUE == true`
656
656
/// * `inout_set | in_set` if `BOTTOM_VALUE == false`
657
657
///
658
658
/// This means that if a bit is not `BOTTOM_VALUE`, it is propagated into all target blocks.
659
659
/// For clarity, the above statement again from a different perspective:
660
- /// A block's initial bit value is `!BOTTOM_VALUE` if *any* predecessor block's bit value is
660
+ /// A bit in the block's entry set is `!BOTTOM_VALUE` if *any* predecessor block's bit value is
661
661
/// `!BOTTOM_VALUE`.
662
+ ///
662
663
/// There are situations where you want the opposite behaviour: propagate only if *all*
663
- /// predecessor blocks's value is `!BOTTOM_VALUE`. In that case you need to
664
+ /// predecessor blocks's value is `!BOTTOM_VALUE`.
665
+ /// E.g. if you want to know whether a bit is *definitely* set at a specific location. This
666
+ /// means that all code paths leading to the location must have set the bit, instead of any
667
+ /// code path leading there.
668
+ ///
669
+ /// If you want this kind of "definitely set" analysis, you need to
664
670
/// 1. Invert `BOTTOM_VALUE`
665
671
/// 2. Reset the `entry_set` in `start_block_effect` to `!BOTTOM_VALUE`
666
672
/// 3. Override `join` to do the opposite from what it's doing now.
0 commit comments