Open
Description
Local value numbering, local to a basic block, doesn't require SSA form, unlike global value numbering. We could straightforwardly run this optimization on MIR. In many cases, this would subsume constant and copy propagation, and it would also let us do nice things like detect commutativity and fold a + b
and b + a
together. It may be possible to do things that LLVM won't, due to it being much easier to prove &
and &mut
s disjoint when done on MIR.