[llvm-commits] [llvm] r83010 - /llvm/trunk/lib/VMCore/AsmWriter.cpp
Devang Patel
dpatel at apple.com
Wed Oct 7 09:38:39 PDT 2009
On Oct 6, 2009, at 5:44 PM, Jeffrey Yasskin wrote:
> 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.
Yup. Fixed in r83462.
-
Devang
> Let me know if you need a more precise test case.
>
> On Mon, Sep 28, 2009 at 1:56 PM, Devang Patel <dpatel at apple.com>
> wrote:
> Author: dpatel
> Date: Mon Sep 28 15:56:00 2009
> New Revision: 83010
>
> URL: http://llvm.org/viewvc/llvm-project?rev=83010&view=rev
> Log:
> Do not hardcode metadata names.
>
> Modified:
> llvm/trunk/lib/VMCore/AsmWriter.cpp
>
> Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=83010&r1=83009&r2=83010&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
> +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Sep 28 15:56:00 2009
> @@ -1266,6 +1266,7 @@
> TypePrinting TypePrinter;
> AssemblyAnnotationWriter *AnnotationWriter;
> std::vector<const Type*> NumberedTypes;
> + DenseMap<unsigned, const char *> MDNames;
>
> public:
> inline AssemblyWriter(formatted_raw_ostream &o, SlotTracker &Mac,
> @@ -1273,6 +1274,14 @@
> AssemblyAnnotationWriter *AAW)
> : Out(o), Machine(Mac), TheModule(M), AnnotationWriter(AAW) {
> AddModuleTypesToPrinter(TypePrinter, NumberedTypes, M);
> + // FIXME: Provide MDPrinter
> + Metadata &TheMetadata = M->getContext().getMetadata();
> + const StringMap<unsigned> *Names = TheMetadata.getHandlerNames();
> + for (StringMapConstIterator<unsigned> I = Names->begin(),
> + E = Names->end(); I != E; ++I) {
> + const StringMapEntry<unsigned> &Entry = *I;
> + MDNames[I->second] = Entry.getKeyData();
> + }
> }
>
> void write(const Module *M) { printModule(M); }
> @@ -1991,11 +2000,16 @@
> Out << ", align " << cast<StoreInst>(I).getAlignment();
> }
>
> - // Print DebugInfo
> + // Print Metadata info
> Metadata &TheMetadata = I.getContext().getMetadata();
> - unsigned MDDbgKind = TheMetadata.getMDKind("dbg");
> - if (const MDNode *Dbg = TheMetadata.getMD(MDDbgKind, &I))
> - Out << ", dbg !" << Machine.getMetadataSlot(Dbg);
> + const Metadata::MDMapTy *MDMap = TheMetadata.getMDs(&I);
> + if (MDMap)
> + for (Metadata::MDMapTy::const_iterator MI = MDMap->begin(),
> + ME = MDMap->end(); MI != ME; ++MI)
> + if (const MDNode *MD = dyn_cast_or_null<MDNode>(MI->second))
> + Out << ", " << MDNames[MI->first]
> + << " !" << Machine.getMetadataSlot(MD);
> +
> printInfoComment(I);
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20091007/1fa6fc01/attachment.html>
More information about the llvm-commits
mailing list