Debian Codegraph @

doc/guide/src/CommonSubexp.adoc

raw
1 = CommonSubexp
2
3 <<CommonSubexp#>> is an optimization pass for the <<SSA#>>
4 <<IntermediateLanguage#>>, invoked from <<SSASimplify#>>.
5
6 == Description
7
8 It eliminates instances of common subexpressions.
9
10 == Implementation
11
12 * https://github.com/MLton/mlton/blob/master/mlton/ssa/common-subexp.fun[`common-subexp.fun`]
13
14 == Details and Notes
15
16 In addition to getting the usual sorts of things like
17
18 * {empty}
19 +
20 ----
21 (w + 0wx1) + (w + 0wx1)
22 ----
23 +
24 rewritten to
25 +
26 ----
27 let val w' = w + 0wx1 in w' + w' end
28 ----
29
30 it also gets things like
31
32 * {empty}
33 +
34 ----
35 val a = Array_uninit n
36 val b = Array_length a
37 ----
38 +
39 rewritten to
40 +
41 ----
42 val a = Array_uninit n
43 val b = n
44 ----