Skip to main content

canonicalize_binary_operations

Function canonicalize_binary_operations 

Source
pub(crate) fn canonicalize_binary_operations<'tcx, 'body>(
    tcx: TyCtxt<'tcx>,
    local_decls: &'body LocalDecls<'tcx>,
    op: &mut BinOp,
    lhs: &mut Operand<'tcx>,
    rhs: &mut Operand<'tcx>,
) -> bool
Expand description

Canonicalize binary operations:

  1. op(const, place) -> op(place, const)
  2. op(place _2, place _1) -> op(place _1, place _2)

For ops </<=/>/>=, we would also modify the op itself.