<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 26, 2014 at 10:11 AM, Adrian Prantl <span dir="ltr"><<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
On Feb 26, 2014, at 3:06, Chandler Carruth <<a href="mailto:chandlerc@gmail.com">chandlerc@gmail.com</a>> wrote:<br>
<br>
<br>
Thanks for the review, Chandler! Your comments raise good points and I will address them in the next revision.<br>
<br>
Regarding this one:<br>
<div class=""><br>
> Comment at: lib/Transforms/Scalar/SROA.cpp:426-429<br>
> @@ -419,1 +425,6 @@<br>
><br>
> +    // Make a best effort to find a dbg.declare intrinsic describing<br>
> +    // the alloca by peeking at the next instruction.<br>
> +    if (DbgDeclareInst *DDI=dyn_cast_or_null<DbgDeclareInst>(SI.getNextNode()))<br>
> +      S.DbgDeclare = DDI;<br>
> +<br>
> ----------------<br>
> This seems like a total hack.<br>
><br>
> It papers over the fact that this is not relevant for a particular store, but for the entire alloca.<br>
><br>
> Why can't we find this by locating the use of the alloca in the metadata and then the intrinsic using the metadata? I know it's a non-standard edge in the IR, but I was pretty sure it was still *an* edge in the IR somewhere that would let us find this?<br>

><br>
<br>
<br>
</div>Eric or David,<br>
<br>
_is_ there a canonical way to find a debug declare intrinsic for a specific alloca?</blockquote><div><br></div><div>I doubt it. I don't think we have any side table that would store and keep that information up to date (which is what we'd need for it to be anything other than a linear scan through instructions). If that's something we should have/is reasonable, I imagine we could add one.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> I had this problem before, and the best I could come up with was to scan through every instruction and then check whether it is a debug intrinsic and describes that alloca, but IMO that’s too expensive, which is why I write code like the snippet above.<br>

<br>
thanks,<br>
Adrian</blockquote></div><br></div></div>