<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 3, 2014 at 11:06 AM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On 2014-Nov-03, at 10:40, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> On Mon, Nov 3, 2014 at 10:13 AM, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:<br>
> Author: dexonsmith<br>
> Date: Mon Nov  3 12:13:57 2014<br>
> New Revision: 221167<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=221167&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=221167&view=rev</a><br>
> Log:<br>
> IR: MDNode => Value: Instruction::getAllMetadataOtherThanDebugLoc()<br>
><br>
> Change `Instruction::getAllMetadataOtherThanDebugLoc()` from a vector of<br>
> `MDNode` to one of `Value`.  Part of PR21433.<br>
><br>
> This does seem like a rather unfortunate loss in type safety - is there no common type here other than Value*? Should we introduce one.<br>
><br>
> (more broadly, I do wonder if there's some common API we could expose via MDNode so as not to end up with two kinds of metadata... but I've not really been able to wrap my head around this enough to have a well informed perspective)<br>
><br>
<br>
</span>Because of the overlap in API between `User` and `MDNode` -- they both<br>
have operands, but deal with them completely differently -- the only<br>
sane common base class between `MDNode` and `MDUser`/`CustomMD` is<br>
`Value`.  Otherwise, `MDNode` would have to inherit from `User`<br>
somehow which is (IMO) significantly worse.<br></blockquote><div><br>What's the cost in having MDNode inherit from User (and thus, indirectly, from Value)? You mention that we already pretty regularly have Values that aren't Users - would this instance be particularly worse? Is any instance so bad that it's worth doing these other contortions instead?<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I threw some thoughts on a longer term fix into PR21438 [1] last week<br>
though, since this is bothering me too.<br>
<br>
[1]: <a href="http://llvm.org/bugs/show_bug.cgi?id=21438" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=21438</a></blockquote><div><br>Right, I vaguely recall reading that - thanks for the (re)pointer. </div></div><br></div></div>