<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 20, 2009, at 2:48 PM, Chris Lattner wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On Oct 20, 2009, at 7:08 AM, Devang Patel wrote:<br><blockquote type="cite"><blockquote type="cite">This would shrink them significantly and reduce the games you have to<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">play with hiding getNumOperands, overloading operator new, etc.  Also,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">MetadataBase doesn't have much common state, it isn't clear it needs<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">to exist at all.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">There is some seriously confused code circling around<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">MetadataBase::resizeOperands.  It looks like half the code thinks that<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">operands can happen, but half doesn't.  Please remove all this stuff.<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">It is trying to maintain following use counts<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">!1 = { i32 1} ; [uses 1]<br></blockquote><blockquote type="cite">!2 = {  !1 }   ; [uses 0]<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">...<br></blockquote><blockquote type="cite">call @llvm.dbg.blah(!1, !2)<br></blockquote><blockquote type="cite">...<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Metadata used by another metadata is counted as regular uses. Metadata<br></blockquote><blockquote type="cite">used by non-metadata values is not a normal use (it is invisible to<br></blockquote><blockquote type="cite">the non-metadata value). This is why the hierarchy is based on User<br></blockquote><blockquote type="cite">and operand list is only counting metadata uses.<br></blockquote><br>Ok, I see now that you're doing this.  But why? :)  What capability does this provide?  Is there another way to get it?  This capability costs a lot of complexity, memory and compile time.<font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote></div><div><br></div><div>This may be useful to reduce memory pressure by allowing metadata user to delete MDNode and its MDNode users. After stumbling couple of times to get this, I am also wondering whether this is worth it or not or is this the right approach. </div><div><br></div><div>MDNodes are uniqued, just like Constant. However Constants become zoombie if its use count is reduced to zero. This may be too expensive for metadata because of possibility of high volume of metadata in the IR due to various reasons.</div><div><br></div><div>-</div><div>Devang</div></body></html>