<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>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.<div><br></div><div>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?</div><div><br></div><div>Erdem.<br><br><div><hr id="stopSpelling">Subject: Re: [llvm-dev] Re-numbering address space with a pass<br>From: arsenm2@gmail.com<br>Date: Sun, 1 Nov 2015 13:14:22 -0800<br>CC: llvm-dev@lists.llvm.org<br>To: erdemderebasoglu@hotmail.com<br><br><br><div><blockquote><div>On Nov 1, 2015, at 2:30 AM, Erdem Derebaþoðlu via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="ecxApple-interchange-newline"><div><div dir="ltr" style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;">Hi all,<div><br></div><div>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.</div><div><br></div><div>Thanks,</div><div>Erdem.</div></div><span style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline !important;">_______________________________________________</span><br style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;"><span style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline !important;">LLVM Developers mailing list</span><br style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;"><a href="mailto:llvm-dev@lists.llvm.org" style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;">llvm-dev@lists.llvm.org</a><br style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;"><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></div></blockquote></div><br><div>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.</div><div><br></div><div>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.</div><div><br></div><div>-Matt</div></div></div>                                           </div></body>
</html>