summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/AsmWriter.cpp
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-01-07 20:14:30 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-01-07 20:14:30 +0000
commitb9b50aaffddf9b3d7b22f42a332811dddb6b9440 (patch)
tree4d81113afb7fb522cacb152e85c33070a5bac641 /llvm/lib/IR/AsmWriter.cpp
parentd9d28926682c20e90fb3e75c5cb990742bfd09fe (diff)
downloadbcm5719-llvm-b9b50aaffddf9b3d7b22f42a332811dddb6b9440.tar.gz
bcm5719-llvm-b9b50aaffddf9b3d7b22f42a332811dddb6b9440.zip
Fix crash when printing instructions that have a metadata attached but no parent.
Fix PR24852 (crash with -debug -instcombine) Patch by Than McIntosh <thanm@google.com> Summary: Add guards to the asm writer to prevent crashing when dumping an instruction that has no basic block. Differential Revision: http://reviews.llvm.org/D15798 From: Than McIntosh <thanm@google.com> llvm-svn: 257094
Diffstat (limited to 'llvm/lib/IR/AsmWriter.cpp')
-rw-r--r--llvm/lib/IR/AsmWriter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 1ebe9b7ee5b..0ce44e105cc 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -3121,7 +3121,7 @@ void AssemblyWriter::printMetadataAttachments(
return;
if (MDNames.empty())
- TheModule->getMDKindNames(MDNames);
+ MDs[0].second->getContext().getMDKindNames(MDNames);
for (const auto &I : MDs) {
unsigned Kind = I.first;
OpenPOWER on IntegriCloud