Esentially, I'm working on a translator someone started building for llvm2.9 that translates an optimized .lln file to another intermediate language, and I'm porting it to 3.1. There is a new intrinsic that pops up in our test cases' lln files that never used to, llvm.lifetime.start. I looked up the description: "The 'llvm.lifetime.start' intrinsic specifies the start of a memory object's lifetime." However, it's still not clear to me what exactly i should do; should this actually be translated to anything (like a call to malloc or something), or is it just used to keep information about the memory object? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120713/771d1666/attachment.html>
Dmitry N. Mikushin
2012-Jul-13 16:17 UTC
[LLVMdev] llvm.lifetime.start; what does it do exactly?
Dear Ryan, I think the lifetime works more like a hint for certain optimizations. For example, if inliner pass sees two variables with non-untersecting lifetimes, it may decide to make them to share the same chunk of stack space (alloca). So, it would not be any error, if you completely ignore it. - D. 2012/7/13 ryan baird <ryanrbaird at gmail.com>> Esentially, I'm working on a translator someone started building for > llvm2.9 that translates an optimized .lln file to another intermediate > language, and I'm porting it to 3.1. > > There is a new intrinsic that pops up in our test cases' lln files that > never used to, llvm.lifetime.start. I looked up the description: "The > 'llvm.lifetime.start' intrinsic specifies the start of a memory object's > lifetime." However, it's still not clear to me what exactly i should do; > should this actually be translated to anything (like a call to malloc or > something), or is it just used to keep information about the memory object? > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120713/13701468/attachment.html>
Duncan Sands
2012-Jul-13 16:40 UTC
[LLVMdev] llvm.lifetime.start; what does it do exactly?
Hi Ryan, On 13/07/12 17:58, ryan baird wrote:> Esentially, I'm working on a translator someone started building for llvm2.9 > that translates an optimized .lln file to another intermediate language, and I'm > porting it to 3.1. > > There is a new intrinsic that pops up in our test cases' lln files that never > used to, llvm.lifetime.start. I looked up the description: "The > 'llvm.lifetime.start' intrinsic specifies the start of a memory object's > lifetime." However, it's still not clear to me what exactly i should do; > should this actually be translated to anything (like a call to malloc or > something), or is it just used to keep information about the memory object?you can safely ignore it. The basic use case is this: function A calls function B, and the optimizers inline the call. Local variables of (the inlined) B now get a declaration at the start of A, but they are only actually used in the inlined B code, not before nor after. Adding a lifetime.start just before the inlined code, and a lifetime.end just after, explains this to the optimizers and code generators, which makes it easier for them to exploit this information. Ciao, Duncan.