<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Feb 23, 2017 at 1:23 PM Adrian Prantl <<a href="mailto:aprantl@apple.com">aprantl@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="gmail_msg">
> On Feb 23, 2017, at 1:07 PM, Mehdi Amini <<a href="mailto:mehdi.amini@apple.com" class="gmail_msg" target="_blank">mehdi.amini@apple.com</a>> wrote:<br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
>> On Feb 23, 2017, at 12:54 PM, Peter Collingbourne <<a href="mailto:peter@pcc.me.uk" class="gmail_msg" target="_blank">peter@pcc.me.uk</a>> wrote:<br class="gmail_msg">
>><br class="gmail_msg">
>> On Thu, Feb 23, 2017 at 12:04 PM, Mehdi AMINI via Phabricator via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br class="gmail_msg">
>> mehdi_amini created this revision.<br class="gmail_msg">
>> Herald added a subscriber: aprantl.<br class="gmail_msg">
>><br class="gmail_msg">
>> It is illegal to have a call without debug info attached in a function<br class="gmail_msg">
>> with debug info: it'll crash the backend.<br class="gmail_msg">
>><br class="gmail_msg">
>> Isn't that a bug in the backend? What happens if I inline a function compiled without debug info into a function compiled with debug info?<br class="gmail_msg">
><br class="gmail_msg">
> See my update, this is in the verifier.<br class="gmail_msg">
> However I agree with you that this seems suspicious: what if LTO or ThinLTO make available a definition without debug info into a file with debug info.<br class="gmail_msg">
><br class="gmail_msg">
> CC Adrian to clarify?<br class="gmail_msg">
<br class="gmail_msg">
- inlining a function without debug info into function with debug info and a location on the call site works: IIRC the inlined nodebug function will inherit the location of the call site. (+david who has a prepared statement explaining this in detail ;-)<br class="gmail_msg">
- inlining a function withdebug info into a function without debug info also works<br class="gmail_msg">
- it is only inlining a function with debug info into another function with debug info but no location on the call site that is dangerous.<br class="gmail_msg"></blockquote><div><br></div><div>Yep, pretty much all this. With a little nuance of "a function with debug info" - this includes a function that may have debugloc-having instructions in it even though the function itself doesn't have an associated subprogram.<br><br>eg: f1 calls f2 calls f3, f1 and f3 built with debug info - in that case the call to f2 must have debug info if there's going to be inlining of f3 -> f2 -> f1.</div><div><br></div><div>I tried various stronger constraints back when I figured out this was a problem, but there were cases where it seemed reasonable for a nodebug function to be inlined into a debug-having function when the call site didn't have a location (inlining intrinsics which have nodebug so that they look like the code was written inline).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="gmail_msg">
-- adrian<br class="gmail_msg">
</blockquote></div></div>