[llvm-dev] Re-numbering address space with a pass
Matt Arsenault via llvm-dev
llvm-dev at lists.llvm.org
Sun Nov 1 13:14:22 PST 2015
> 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>
More information about the llvm-dev
mailing list