<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Feb 22, 2017 at 4:21 PM Adrian Prantl via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">aprantl added a comment.<br class="gmail_msg">
<br class="gmail_msg">
[apologies for iterating so slowly at the moment]<br class="gmail_msg">
<br class="gmail_msg">
In <a href="https://reviews.llvm.org/D29833#682595" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D29833#682595</a>, @twoh wrote:<br class="gmail_msg">
<br class="gmail_msg">
> Personally I prefer the existing API, because it doesn't allow the transient state before merging. For example, in lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp in this patch, DebugLoc of NewSI is not actually valid after line 1430. Existing API doesn't have this problem.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
If that is the only concern, would an additional convenience function solve (= sufficiently hide) the problem?<br class="gmail_msg">
<br class="gmail_msg">
  Instruction::setMergedDebugLoc(DebugLoc A, DebugLoc B) {<br class="gmail_msg">
    setDebugLoc(A);<br class="gmail_msg">
    mergeDebugLocWith(B);<br class="gmail_msg">
  }<br class="gmail_msg">
<br class="gmail_msg">
The primary benefit of having the API on Instruction is that we can make it impossible to accidentally create a locationless call instruction in a function with debuginfo (which would crash/assert the backend when creating inline scopes).<br class="gmail_msg"></blockquote><div><br></div><div>Either way we have a bug - either the profile will be buggy or the inlining broken, honestly since the buggy profile is harder to diagnose (because it has a location, but an incorrect one) I'd sort of favor an API that makes those bugs easy/the default, rather than the subtlety of incorrect locations.</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">
<br class="gmail_msg">
Repository:<br class="gmail_msg">
  rL LLVM<br class="gmail_msg">
<br class="gmail_msg">
<a href="https://reviews.llvm.org/D29833" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D29833</a><br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
</blockquote></div></div>