[LLVMdev] mem2reg optimization

Dan Gohman gohman at apple.com
Tue Oct 7 09:29:50 PDT 2008


On Mon, October 6, 2008 10:32 pm, Nicolas Capens wrote:
> Hi Dan,
>
> I don't want to beat a dead horse here, but why would anyone want to use
> mem2reg after LICM or other passes that can move around loads and stores?
> I
> fully understand the design goal to arbitrarily reorder other passes but
> for
> mem2reg it actually seems vital to run it as the first pass to make all
> other passes useful.

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 :-).

Dan





More information about the llvm-dev mailing list