Debian Codegraph @

doc/guide/src/Redundant.adoc

raw
1 = Redundant
2
3 <<Redundant#>> is an optimization pass for the <<SSA#>>
4 <<IntermediateLanguage#>>, invoked from <<SSASimplify#>>.
5
6 == Description
7
8 The redundant SSA optimization eliminates redundant function and label
9 arguments; an argument of a function or label is redundant if it is
10 always the same as another argument of the same function or label.
11 The analysis finds an equivalence relation on the arguments of a
12 function or label, such that all arguments in an equivalence class are
13 redundant with respect to the other arguments in the equivalence
14 class; the transformation selects one representative of each
15 equivalence class and drops the binding occurrence of
16 non-representative variables and renames use occurrences of the
17 non-representative variables to the representative variable. The
18 analysis finds the equivalence classes via a fixed-point analysis.
19 Each vector of arguments to a function or label is initialized to
20 equivalence classes that equate all arguments of the same type; one
21 could start with an equivalence class that equates all arguments, but
22 arguments of different type cannot be redundant. Variables bound in
23 statements are initialized to singleton equivalence classes. The
24 fixed-point analysis repeatedly refines these equivalence classes on
25 the formals by the equivalence classes of the actuals.
26
27 == Implementation
28
29 * https://github.com/MLton/mlton/blob/master/mlton/ssa/redundant.fun[`redundant.fun`]
30
31 == Details and Notes
32
33 The reason <<Redundant#>> got put in was due to some output of the
34 <<ClosureConvert#>> pass converter where the environment record, or
35 components of it, were passed around in several places. That may have
36 been more relevant with polyvariant analyses (which are long gone).
37 But it still seems possibly relevant, especially with more aggressive
38 flattening, which should reveal some fields in nested closure records
39 that are redundant.