for what it is worth
(1) rearranging expressions does not guaranteed that they
will evaluate to the same values, given floating-point data.
(2) this ad hoc searching for common subexpressions is
not going to extract the best way of evaluating (say)
polynomials that can be factored, or can be evaluated
by some divide-and-conquer halving. Or matrix
expressions with fast operations. Or FFT-related speedups.
The biggest payoffs traditionally in compiler technology
(look this stuff up if you don't know it) is in moving
expression evaluation outside of loops, or even improving
the evaluation of the loop index.
RJF