Answers are grounded in this paper and cite their sources.
This paper shows the problem of generating optimal code for expressions containing common subexpressions is computationally difficult, even for simple expressions and simple machines. Some heuristics for code generation are given and their worst-case behavior is analyzed. For one register machines, an optimal code generation algorithm is given whose time complexity is linear in the size of an expression and exponential only in the amount of sharing.
No takes yet. Share an insight, caveat, or question.
Aho et al. (1977) studied this question.
Synapse has enriched 10 related papers. Consider them for comparative context: