Erdem Derebaşoğlu via llvm-dev
2015-Nov-01 10:30 UTC
[llvm-dev] Re-numbering address space with a pass
Hi all, I would like my optimization pass to change an object's address space that is created by llvm.lifetime.start intrinsic. Because I want to be able to identify them later in a codegen pass. I can get a pointer from the intrinsic using CallInst::getArgOperand() function. However, I don't know what to do with it (or if it is the pointer that I want). How can I change its address space? If there is an easier way to "mark" that object, I would like to know that too. Thanks,Erdem. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151101/a49dbbef/attachment.html>
Matt Arsenault via llvm-dev
2015-Nov-01 21:14 UTC
[llvm-dev] Re-numbering address space with a pass
> On Nov 1, 2015, at 2:30 AM, Erdem Derebaşoğlu via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi all, > > I would like my optimization pass to change an object's address space that is created by llvm.lifetime.start intrinsic. Because I want to be able to identify them later in a codegen pass. I can get a pointer from the intrinsic using CallInst::getArgOperand() function. However, I don't know what to do with it (or if it is the pointer that I want). How can I change its address space? If there is an easier way to "mark" that object, I would like to know that too. > > Thanks, > Erdem. > _______________________________________________ > 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>There’s no easy way to change the address space of a value, though I would like there to be one. You have to specifically handle all users and use mutateType. AMDGPUPromoteAlloca is an example of a pass which does this, although it’s somewhat buggy. If you’re just trying to identify the pointer with an address space, you should be fine using an addrspacecast. What are you trying to do with this? I don’t see why you would need special handling just to identify these. In a codegen pass you can look at the LIFETIME_START/LIFETIME_END operand which will give you the frame index which you can identify users with. -Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151101/c372c22d/attachment.html>
Erdem Derebaşoğlu via llvm-dev
2015-Nov-02 13:50 UTC
[llvm-dev] Re-numbering address space with a pass
My goal is to place thread-private variables in a different address space than shared variables in an OpenMP program. I found out that lifetime.start instrinsic starts the lifetime of shared objects before entering a parallel region (in IR). So I am thinking about changing the address space of all variables excluding those. If I do it with a codegen pass, how can I look for lifetime_start/end operands (since they are defined in IR level)? And when I do an addrspacecast, how do I preserve the type? Erdem. Subject: Re: [llvm-dev] Re-numbering address space with a pass From: arsenm2 at gmail.com Date: Sun, 1 Nov 2015 13:14:22 -0800 CC: llvm-dev at lists.llvm.org To: erdemderebasoglu at hotmail.com On Nov 1, 2015, at 2:30 AM, Erdem Derebaşoğlu via llvm-dev <llvm-dev at lists.llvm.org> wrote:Hi all, I would like my optimization pass to change an object's address space that is created by llvm.lifetime.start intrinsic. Because I want to be able to identify them later in a codegen pass. I can get a pointer from the intrinsic using CallInst::getArgOperand() function. However, I don't know what to do with it (or if it is the pointer that I want). How can I change its address space? If there is an easier way to "mark" that object, I would like to know that too. Thanks,Erdem._______________________________________________LLVM Developers mailing listllvm-dev at lists.llvm.orghttp://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev There’s no easy way to change the address space of a value, though I would like there to be one. You have to specifically handle all users and use mutateType. AMDGPUPromoteAlloca is an example of a pass which does this, although it’s somewhat buggy. If you’re just trying to identify the pointer with an address space, you should be fine using an addrspacecast. What are you trying to do with this? I don’t see why you would need special handling just to identify these. In a codegen pass you can look at the LIFETIME_START/LIFETIME_END operand which will give you the frame index which you can identify users with. -Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151102/c929580f/attachment.html>