We present the goals and the main ideas behind the implementation of a new pass that performs Common Subexpression Elimination (CSE) for TIR. This pass identifies redundant computations (subexpressions) and replaces them by new variables, thus avoiding the overhead of performing the same computation multiple times.
Generated code like TIR often contains some duplicated computations and can benefit well from a CSE pass.
In addition, the implementation is modular in several directions: in particular, it is easy to modify the criteria which selects which computations get introduced into variables. It is also easy to extend the pass for identifying and commoning semantically equivalent computations instead of only syntactically equal ones.
This session is broken into to parts, a 20 minute talk followed by a 5 minute breakout session.