cairo_lang_lowering::optimizations

Module remappings

Source
Expand description

Remove unnecessary remapping of variables optimization.

At each convergence, we have one or more branches with remappings of variables. A destination variable dest introduced by the remappings must be remapped at every branch b_i by mapping a source variable src_i->dest. We require that every use of dest refers to the correct src_i. This means that the remappings to dest are not necessary in these cases:

  1. There is no flow that uses the “value” of dest after the convergence.
  2. All the src_i variables get the same “value”.

Functions§