<div class="gmail_quote">2009/11/30 Devang Patel <span dir="ltr"><<a href="mailto:devang.patel@gmail.com">devang.patel@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div class="im">On Thu, Nov 26, 2009 at 2:31 PM, Nick Lewycky <<a href="mailto:nicholas@mxc.ca">nicholas@mxc.ca</a>> wrote:<br>
> Hi Devang,<br>
><br>
> Before I get to the contents of this particular patch, I have a higher-level<br>
> design question. Why is metadata stored off the LLVMContext?<br>
<br>
</div>Why do we have FPConstants, IntConstants etc.. in LLVMContext ? :)<br></blockquote><div><br>So you can build up Constants and Instructions before inserting them where they'll be used. I suppose that sounds reasonable to do for metadata too.<br>

<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">
> That seems like<br>
> the wrong place to me, this data is all specific to the particular module.<br>
> Specifically, a single MDNode may not cross modules, and if a module is<br>
> destroyed we should eliminate all the metadata that came with it.<br>
<br>
</div>Metadata is not connected with a Module. Module does not own metadata.<br>
Metadata is on the side, observing Values.<br></blockquote><div><br>But your patch changes that for debug info. You've added a pointer to Instruction (a WeakVH DbgInfo). What's the memory usage penalty of that on a large program?<br>

<br>If we're willing to pay this memory cost, even for programs that aren't using debug info, why not just store pointer to a linked list of metadata info in the Instruction and remove the MetadataContext? If it's a 10% performance win for debug info we should be able to get the exact same win across the board for all metadata with no cost beyond what your patch already proposes.<br>

<br>Nick<br><br></div></div>