[llvm-dev] Does anything depend on reg2mem?

Reid Kleckner via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 26 11:55:12 PST 2022


I looked into this back when we were working on Windows EH around four
years ago, and at the time, so far as I could tell, no, nothing depends on
reg2mem. I asked Dan Gohman about it at the time, and he said that
essentially SSAUpdater was introduced and rolled out across the codebase to
address these CFG manipulation use cases properly.

I believe there may exist passes that call into reg2mem helper functions to
demote specific values into memory across certain operations such as
setjmp, for example. Parts of the code may still be in use, but IMO the
pass can be deleted.

On Sun, Jan 16, 2022 at 5:10 AM Russell Wallace via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> According to the documentation,
>
> > This file demotes all registers to memory references. It is intended to
> be the inverse of mem2reg. By converting to load instructions, the only
> values live across basic blocks are alloca instructions and load
> instructions before phi nodes. It is intended that this should make CFG
> hacking much easier. To make later hacking easier, the entry block is split
> into two, such that all introduced alloca instructions (and nothing else)
> are in the entry block.
>
> It does make sense that converting everything back to memory references,
> would make CFG hacking easier. For example, simplifycfg would have an
> easier job if it requires reg2mem to have been run first.
>
> Does simplifycfg, or any other pass, actually have a 'reg2mem must have
> been run first' dependency?
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20220126/b1af250a/attachment.html>


More information about the llvm-dev mailing list