<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 14, 2009, at 11:48 AM, Nick Lewycky wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Verdana; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Devang Patel wrote:<br><blockquote type="cite">Author: dpatel<br></blockquote><blockquote type="cite">Date: Wed Oct 14 12:02:49 2009<br></blockquote><blockquote type="cite">New Revision: 84113<br></blockquote><blockquote type="cite">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=84113&view=rev">http://llvm.org/viewvc/llvm-project?rev=84113&view=rev</a><br></blockquote><blockquote type="cite">Log:<br></blockquote><blockquote type="cite">Add copyMD to copy metadata from one instruction to another instruction.<br></blockquote><blockquote type="cite">Modified:<br></blockquote><blockquote type="cite">   llvm/trunk/include/llvm/Metadata.h<br></blockquote><blockquote type="cite">   llvm/trunk/lib/VMCore/Metadata.cpp<br></blockquote><blockquote type="cite">Modified: llvm/trunk/include/llvm/Metadata.h<br></blockquote><blockquote type="cite">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Metadata.h?rev=84113&r1=84112&r2=84113&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Metadata.h?rev=84113&r1=84112&r2=84113&view=diff</a><br></blockquote><blockquote type="cite">==============================================================================<br></blockquote><blockquote type="cite">--- llvm/trunk/include/llvm/Metadata.h (original)<br></blockquote><blockquote type="cite">+++ llvm/trunk/include/llvm/Metadata.h Wed Oct 14 12:02:49 2009<br></blockquote><blockquote type="cite">@@ -351,6 +351,10 @@<br></blockquote><blockquote type="cite">  /// removeMDs - Remove all metadata attached with an instruction.<br></blockquote><blockquote type="cite">  void removeMDs(const Instruction *Inst);<br></blockquote><blockquote type="cite">+  /// copyMD - If metadata is attached with Instruction In1 then attach<br></blockquote><blockquote type="cite">+  /// the same metadata to In2.<br></blockquote><blockquote type="cite">+  void copyMD(Instruction *In1, Instruction *In2);<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">  /// getHandlerNames - Get handler names. This is used by bitcode<br></blockquote><blockquote type="cite">  /// writer.<br></blockquote><blockquote type="cite">  const StringMap<unsigned> *getHandlerNames();<br></blockquote><blockquote type="cite">Modified: llvm/trunk/lib/VMCore/Metadata.cpp<br></blockquote><blockquote type="cite">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=84113&r1=84112&r2=84113&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=84113&r1=84112&r2=84113&view=diff</a><br></blockquote><blockquote type="cite">==============================================================================<br></blockquote><blockquote type="cite">--- llvm/trunk/lib/VMCore/Metadata.cpp (original)<br></blockquote><blockquote type="cite">+++ llvm/trunk/lib/VMCore/Metadata.cpp Wed Oct 14 12:02:49 2009<br></blockquote><blockquote type="cite">@@ -359,6 +359,20 @@<br></blockquote><blockquote type="cite">  MetadataStore.erase(I);<br></blockquote><blockquote type="cite">}<br></blockquote><blockquote type="cite">+/// copyMD - If metadata is attached with Instruction In1 then attach<br></blockquote><blockquote type="cite">+/// the same metadata to In2.<br></blockquote><blockquote type="cite">+void MetadataContext::copyMD(Instruction *In1, Instruction *In2) {<br></blockquote><blockquote type="cite">+  assert (In1 && In2 && "Invalid instruction!");<br></blockquote><blockquote type="cite">+   MDStoreTy::iterator I = MetadataStore.find(In1);<br></blockquote><blockquote type="cite">+  if (I == MetadataStore.end())<br></blockquote><blockquote type="cite">+    return;<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+  MDMapTy &In1Info = I->second;<br></blockquote><blockquote type="cite">+  MDMapTy In2Info;<br></blockquote><blockquote type="cite">+  for (MDMapTy::iterator I = In1Info.begin(), E = In1Info.end(); I != E; ++I)<br></blockquote><blockquote type="cite">+    if (MDNode *MD = dyn_cast_or_null<MDNode>(I->second))<br></blockquote><br>When would this be null? </span></blockquote><div><br></div><div>If it was replaced or deleted.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Verdana; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">If it's "!metadata null" we want to push a null metadata onto the target instruction, right?<br></span></blockquote></div><br><div>I am not sure.</div><div>-</div><div>Devang</div></body></html>