Rodney M. Bates via llvm-dev
2017-Jul-23 21:06 UTC
[llvm-dev] Advise on which copy to use.
I am generating llvm code for nested procedures. Each one gets a static link, which I am passing as an internally added, first parameter. However, it needs to be stored in memory too, so a debugger can find it. So, when I need to use the value, is it better to use the ssl parameter or load the memory copy? I can imagine the ssl value might avoid unnecessary fetches, but then, it might also sometimes result in storage of a second copy in a memory temp. Also, do I need to do something to prevent the unused copy from being eliminated altogether? -- Rodney Bates rodney.m.bates at acm.org
I'd recommend storing the link parameter in memory and loading from it at the first use in every basic block. This should give you the best variable tracking debug info after optimization, because LLVM will insert @llvm.dbg.value calls at the point of each load, and you won't have to do that yourself. On Sun, Jul 23, 2017 at 2:06 PM, Rodney M. Bates via llvm-dev < llvm-dev at lists.llvm.org> wrote:> I am generating llvm code for nested procedures. Each one gets a static > link, > which I am passing as an internally added, first parameter. However, it > needs > to be stored in memory too, so a debugger can find it. So, when I need to > use > the value, is it better to use the ssl parameter or load the memory copy? > > I can imagine the ssl value might avoid unnecessary fetches, but then, it > might also sometimes result in storage of a second copy in a memory temp. > > Also, do I need to do something to prevent the unused copy from being > eliminated altogether? > > -- > Rodney Bates > rodney.m.bates at acm.org > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://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/20170724/d86463c0/attachment.html>
Rodney M. Bates via llvm-dev
2017-Jul-25 02:41 UTC
[llvm-dev] Advise on which copy to use.
Thanks. On 07/24/2017 10:38 AM, Reid Kleckner wrote:> I'd recommend storing the link parameter in memory and loading from it at the first use in every basic block. This should give you the best variable tracking debug info after optimization, because LLVM will insert @llvm.dbg.value calls at the point of each load, and you won't have to do that yourself. > > On Sun, Jul 23, 2017 at 2:06 PM, Rodney M. Bates via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: > > I am generating llvm code for nested procedures. Each one gets a static link, > which I am passing as an internally added, first parameter. However, it needs > to be stored in memory too, so a debugger can find it. So, when I need to use > the value, is it better to use the ssl parameter or load the memory copy? > > I can imagine the ssl value might avoid unnecessary fetches, but then, it > might also sometimes result in storage of a second copy in a memory temp. > > Also, do I need to do something to prevent the unused copy from being > eliminated altogether? > > -- > Rodney Bates > rodney.m.bates at acm.org <mailto:rodney.m.bates at acm.org> > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev> > >-- Rodney Bates rodney.m.bates at acm.org