<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 6, 2009, at 5:44 PM, Jeffrey Yasskin wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">This patch assumes that the Module* parameter to AssemblyWriter() is non-null, but Value::print() in this file can pass NULL. This crashes if you run `opt -instcombine -debug-only=instcombine` on any input where instcombine will replace values. </blockquote><div><br></div><div>Yup. Fixed in r83462.</div><div>-</div><div>Devang</div><div><br></div><blockquote type="cite">Let me know if you need a more precise test case.<br></blockquote><div><br></div></div><div><br><blockquote type="cite">
<br><div class="gmail_quote">On Mon, Sep 28, 2009 at 1:56 PM, Devang Patel <span dir="ltr"><<a href="mailto:dpatel@apple.com">dpatel@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Author: dpatel<br>
Date: Mon Sep 28 15:56:00 2009<br>
New Revision: 83010<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=83010&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=83010&view=rev</a><br>
Log:<br>
Do not hardcode metadata names.<br>
<br>
Modified:<br>
llvm/trunk/lib/VMCore/AsmWriter.cpp<br>
<br>
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=83010&r1=83009&r2=83010&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=83010&r1=83009&r2=83010&view=diff</a><br>
<br>
==============================================================================<br>
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)<br>
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Sep 28 15:56:00 2009<br>
@@ -1266,6 +1266,7 @@<br>
TypePrinting TypePrinter;<br>
AssemblyAnnotationWriter *AnnotationWriter;<br>
std::vector<const Type*> NumberedTypes;<br>
+ DenseMap<unsigned, const char *> MDNames;<br>
<br>
public:<br>
inline AssemblyWriter(formatted_raw_ostream &o, SlotTracker &Mac,<br>
@@ -1273,6 +1274,14 @@<br>
AssemblyAnnotationWriter *AAW)<br>
: Out(o), Machine(Mac), TheModule(M), AnnotationWriter(AAW) {<br>
AddModuleTypesToPrinter(TypePrinter, NumberedTypes, M);<br>
+ // FIXME: Provide MDPrinter<br>
+ Metadata &TheMetadata = M->getContext().getMetadata();<br>
+ const StringMap<unsigned> *Names = TheMetadata.getHandlerNames();<br>
+ for (StringMapConstIterator<unsigned> I = Names->begin(),<br>
+ E = Names->end(); I != E; ++I) {<br>
+ const StringMapEntry<unsigned> &Entry = *I;<br>
+ MDNames[I->second] = Entry.getKeyData();<br>
+ }<br>
}<br>
<br>
void write(const Module *M) { printModule(M); }<br>
@@ -1991,11 +2000,16 @@<br>
Out << ", align " << cast<StoreInst>(I).getAlignment();<br>
}<br>
<br>
- // Print DebugInfo<br>
+ // Print Metadata info<br>
Metadata &TheMetadata = I.getContext().getMetadata();<br>
- unsigned MDDbgKind = TheMetadata.getMDKind("dbg");<br>
- if (const MDNode *Dbg = TheMetadata.getMD(MDDbgKind, &I))<br>
- Out << ", dbg !" << Machine.getMetadataSlot(Dbg);<br>
+ const Metadata::MDMapTy *MDMap = TheMetadata.getMDs(&I);<br>
+ if (MDMap)<br>
+ for (Metadata::MDMapTy::const_iterator MI = MDMap->begin(),<br>
+ ME = MDMap->end(); MI != ME; ++MI)<br>
+ if (const MDNode *MD = dyn_cast_or_null<MDNode>(MI->second))<br>
+ Out << ", " << MDNames[MI->first]<br>
+ << " !" << Machine.getMetadataSlot(MD);<br>
+<br>
printInfoComment(I);<br>
}<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br>
</blockquote></div><br></body></html>