<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 17 February 2015 at 12:46, Andy Ayers <span dir="ltr"><<a href="mailto:andya@microsoft.com" target="_blank">andya@microsoft.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div>
<p class="MsoNormal">In other compilers I’ve worked on there were special pseudo instructions (or similar mechanisms like adding extra source operands to returns) that allowed you to artificially extend lifetimes of values. For instance we might have a requirement
 that a certain local (say the ‘this pointer’) remain live throughout the method.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Is there anything like this in LLVM?</p></div></div></blockquote><div><br></div><div>Do you need this at the IR level? Or in codegen?</div><div><br></div><div>In the IR we use SSA, so variables are live exactly as long as they could be used. There isn't a way to extend lifetimes in the IR per se, you would need to mark it used in some fashion. For instance adding an intrinsic @llvm.gc.range.ends.here(%ssavar) and the value needs to live long enough for that intrinsic to be called. I suppose if it gets called twice, the subsequent calls are no-ops.</div><div><br></div><div>Matt's answer is good if you want it in codegen. Most of the use-cases I can think of apply to codegen anyways.</div><div><br></div><div>Nick</div><div><br></div></div></div></div>