Cse rewrite

A rewrite of common-subexpression-elimination. The old version was pretty flaky.
Is this correct? Shouldn't it return the result of compare_names if it isn't Equal?