<p dir="ltr">That's what discriminators are for - but I've no idea where that fits in the workflow etc.</p>
<p dir="ltr">In any case I'm not sure it's worth worrying about reusing the same line when it happens to be all on the same line (& removing the column - what a debugger would do seeing some things with column info and some without etc)</p>
<br><div class="gmail_quote"><div dir="ltr">On Tue., 18 Oct. 2016, 4:27 pm Paul Robinson, <<a href="mailto:paul.robinson@sony.com">paul.robinson@sony.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">probinson added a comment.<br class="gmail_msg">
<br class="gmail_msg">
In <a href="https://reviews.llvm.org/D25742#573687" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D25742#573687</a>, @aprantl wrote:<br class="gmail_msg">
<br class="gmail_msg">
> In <a href="https://reviews.llvm.org/D25742#573401" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D25742#573401</a>, @probinson wrote:<br class="gmail_msg">
><br class="gmail_msg">
> > In <a href="https://reviews.llvm.org/D25742#573352" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D25742#573352</a>, @aprantl wrote:<br class="gmail_msg">
> ><br class="gmail_msg">
> > > This approach seems generally fine, but I have one question:<br class="gmail_msg">
> > ><br class="gmail_msg">
> > > If the code were on a single line, and both locations share a common ancestor scope, it seems make sense to create a new location using the common ancestor scope and line and only remove the column information.<br class="gmail_msg">
> ><br class="gmail_msg">
> ><br class="gmail_msg">
> > That would collapse the if-then-else into (effectively) a single statement.  That probably works okay for a debugger but not profiling, which still wants to treat the then/else as distinct.  And, after the tail merging, the tails are no longer distinct.<br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
> I'm not sure I understand your point. How is having an orphaned add instruction preferable over having it associated with the collapsed if-then-else statement? Wouldn't I want that instruction to be counted towards the line?<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
No, the profiler wants to assign sample counts to each block individually.  By giving each block the same source attribution, you assert that they have the same profiles.  That's unlikely to be true in practice.  Really what happens is that the sample counts would be assigned to the parent block, which doesn't help the profiler sort out what to do with the nested blocks.<br class="gmail_msg">
<br class="gmail_msg">
Admittedly, zapping the source attribution on the merged (parts of the) blocks doesn't let you attribute those counts to *any* block, but at least you aren't attributing counts incorrectly.<br class="gmail_msg">
<br class="gmail_msg">
Robert may want to correct some of my assumptions here, but this is my understanding.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<a href="https://reviews.llvm.org/D25742" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D25742</a><br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
</blockquote></div>