<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Feb 27, 2018 at 12:48 AM Ulrich Weigand 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">uweigand added a comment.<br>
<br>
In <a href="https://reviews.llvm.org/D43687#1020083" rel="noreferrer" target="_blank">https://reviews.llvm.org/D43687#1020083</a>, @dblaikie wrote:<br>
<br>
> Have you considered a test case where there's a common scope within an inlinedAt location?<br>
><br>
>   SP1 <- S1 <- IA1 <- L1<br>
>            \-- IA2 <- L2<br>
><br>
><br>
> I think it's reasonable for S1 to be the scope of the merged location - as much as it would be if IA1 and IA2 were not present. (SP = Subprogram, S = Scope, IA = InlinedAt, L = Location).<br>
<br>
<br>
Well, there's variants of that scenario: <a href="https://reviews.llvm.org/L1" rel="noreferrer" target="_blank">https://reviews.llvm.org/L1</a> and L2 might already have the same scope, or they might have different scopes.<br></blockquote><div><br>The same scope but inlined in different places?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If <a href="https://reviews.llvm.org/L1" rel="noreferrer" target="_blank">https://reviews.llvm.org/L1</a> and L2 already have the same scope, this **must** remain the scope of the merged location, or else we break debug intrinsics again.</blockquote><div><br>That seems strange - can you explain that constraint & what motivates it in some detail?<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">  If <a href="https://reviews.llvm.org/L1" rel="noreferrer" target="_blank">https://reviews.llvm.org/L1</a> and L2 have different scopes, my current code just uses LocA->getInlinedAtScope() as simple fallback scope, which actually happens to agree with S in your example.  I guess this could still be refined for more complex cases later, if necessary ...<br></blockquote><div><br>Ah - fair point. Well, expand S out to S1, with children S2 and S3 (which are parents of IA1 and IA2). Then I think the algorithm would pick SP1, instead of S1?<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> I /think/ this should be achievable with a single walk, rather than two separate walks (one up scopes, one up inlinedAt's), perhaps?<br>
<br>
Well, if <a href="https://reviews.llvm.org/L1" rel="noreferrer" target="_blank">https://reviews.llvm.org/L1</a> and L2 have the same scope, we need to keep it (see above).  But then if their inlined-at locations are different, we still need to come up with a merged inlined-at location without changing that common scope.  That's why I have two loops.<br>
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D43687" rel="noreferrer" target="_blank">https://reviews.llvm.org/D43687</a><br>
<br>
<br>
<br>
</blockquote></div></div>