find_self_assignments

Function find_self_assignments 

Source
fn find_self_assignments<'tcx>(
    checked_places: &PlaceSet<'tcx>,
    body: &Body<'tcx>,
) -> FxHashSet<Location>
Expand description

Compute self-assignments of the form a += b.

MIR building generates 2 statements and 1 terminator for such assignments:

  • _temp = CheckedBinaryOp(a, b)
  • assert(!_temp.1)
  • a = _temp.0

This function tries to detect this pattern in order to avoid marking statement as a definition and use. This will let the analysis be dictated by the next use of a.

Note that we will still need to account for the use of b.