mem2reg optimization

In addition to the mem2reg pass, the underlying logic is also
exposed via the PromoteMemToReg utility routine, for use in
other passes. In the same way that mem2reg frees front-ends from
having to compute SSA form, PromoteMemToReg can be used by
transformation passes that wish to insert or modify code without
having to jump through SSA hoops themselves. An example of a pass
that uses mem2reg like this today is the LICM pass :-).