[llvm-dev] Does anything depend on reg2mem?

Roman Lebedev via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 26 14:00:25 PST 2022


On Thu, Jan 27, 2022 at 12:17 AM Johannes Doerfert via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
>
> The web is full of scripts and descriptions that tell you to run reg2mem.
>
> If we delete it we will get regular emails that things don't work anymore.
> That said, if we introduce an alias reg2mem -> SROA, we should be fine.
Note that reg2mem is an opposite transform to that of SROA/mem2reg.

NACK to the removal, unless we also remove all of the functionality
that said pass uses, otherwise we are just reducing test coverage,

> ~ Johannes
Roman

> On 1/26/22 13:55, Reid Kleckner via llvm-dev wrote:
> > 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
> >>
> >
> > _______________________________________________
> > LLVM Developers mailing list
> > llvm-dev at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list