<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 13, 2020 at 8:49 PM Alok Sharma <<a href="mailto:aloksharma.knit@gmail.com">aloksharma.knit@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><div>Let me consolidate what we discussed with my opinion.</div><div><br></div><div>* On the point of new intrinsic llvm.dbg.derefval:</div><div></div><div>It (new intrinsic) was more a neater way than a needed way. The whole functionality can go ahead without it and using llvm.dbg.value instead. Though I liked it (new intrinsic), since most of us are against it, it should be fine for me to drop it.</div><div>This is because the transformation was like <br></div><div>llvm.dbg.value -> DBG_VALUE -> DWARF location-list</div><div>llvm.dbg.derefval -> 
DBG_VALUE -> DWARF location-list <br></div><div>Since it was just for better readability in LLVM IR only later it (new intrinsic) was sharing the same path with llvm.dbg.value. So it should be fine to drop it without any impact in later functionality. <br></div><div>- On question of identify such cases we can anyway identify using the type of expression (DW_OP_implicit_pointer).</div><div>- On question of (
DW_OP_implicit_pointer

) fitting to dbg.value intrinsic it perfectly does that as value in such case is metadata and prototype of dbg.value is dbg.value(metadata, metadata, metadata).</div><div>So it should be fine to drop it and back to where it was started before introduction of new intrinsic.<br></div><div><br></div><div>* On the point of handing of pointer pointing to temporary / unnamed variables (Lets call it Scope S1)<br></div><div></div><div>As two proposed patches are there for bringing pointers referring to temporary / unnamed variable</div><div>   A) first patch uses (new proposed operator) 
DW_OP_LLVM_explicit_pointer(both in LLVM-IR and DWARF)</div><div>   B) Second patch uses artificial variable representing temporary (both in LLVM-IR and DWARF)<br></div><div>         <a href="https://reviews.llvm.org/D72055" target="_blank">https://reviews.llvm.org/D72055</a> [DebugInfo] Support for DW_OP_implicit_pointer (for temp references & dynamic allocations)</div><div>If I understood David correctly, he wants LLVM-IR look like patch-A and DWARF look like patch-B (lets call it way C) <br></div><div>Since patch-A is not desired because we don't support anything beyond DWARF-5 and patch proposes new DWARF operator. I want to clarify that patch-B can exist even without new intrinsic and can use dbg.value and fits perfectly in existing LLVM-IR template. if only reason to go way-C is to <br></div><div>I would like to go way-B or way-C for the scope of unnamed variables.</div><div><br></div><div>* For the cases when pointer points to named variable (Lets call it Scope S2):</div><div> I would update the patches with replacing dbg.derefval to dbg.value and using DW_OP_implicit_pointer (to named variable) in both LLVM-IR and DWARF.<br></div><div><br></div><div>In summary, <br></div><div>Scope S1 can be solved with <br></div><div>way-B) 
DW_OP_implicit_pointer with artificial variable and with intrinsic dbg.value in LLVM-IR and DWARF</div><div>or<br></div><div>way-C) DW_OP_LLVM_explicit_pointer with intrinsic dbg.value in LLVM-IR + DW_OP_implicit_pointer with artificial variable in DWARF</div><div><br></div><div>Scope S2 can be solved with</div><div>
DW_OP_implicit_pointer with actual named variable with dbg.value in LLVM-IR and DWARF</div></div></blockquote><div><br>Based on my current understanding, I'd rather not do this ^ it seems like added complexity to LLVM optimizations/middle end/IR representation with limited value. I think doing (C) above but using it to cover both S1 and S2 (ie: not special casing "pointing to an existing variable" - instead treating that the same as "pointing to an unnamed entity") initially, and then, maybe later, evaluating whether referencing named variables from dbg.value is worth the added benefit, would be the right way to go.<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>Regards,</div><div>Alok<br>

</div><div><br></div><div><br></div><div>Though <br></div><div><br></div><div><br></div><div><br></div><div>lets <br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 14, 2020 at 1:28 AM Jeremy Morse <<a href="mailto:jeremy.morse.llvm@gmail.com" target="_blank">jeremy.morse.llvm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
David wrote:<br>
> Are you referring to the possibility of implicit values to refer to other variables? I'm sort of interested in maybe not doing that - and only implementing a more general form (what's been talked about with the LLVM_implicit_value (or was it LLVM_explicit_value? I forget)) - and synthesizing artificial variables in the backend rather than trying to track which variable a pointer points to. I think this would keep the impact on optimizations smaller & would be more general.<br>
<br>
Adrian wrote:<br>
> If it were possible to synthesize it in AsmPrinter, would that remove the motivation for the new intrinsic for you?<br>
<br>
Ah, yeah, those changes would avoid any need for a new intrinsic to my<br>
mind, and sounds much more palatable. Thanks for explaining.<br>
<br>
--<br>
Thanks,<br>
Jeremy<br>
</blockquote></div>
</blockquote></div></div>