diff options
author | Devang Patel <dpatel@apple.com> | 2009-09-04 21:32:05 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-09-04 21:32:05 +0000 |
commit | a33c5a922d76248d11fb4a5567561095664986de (patch) | |
tree | 68c25784b2f572af4cdb5a75c5139993faf49158 /llvm/lib/VMCore/LLVMContext.cpp | |
parent | b7d704dac3dbf6de49c4611f245eb3a5989d6331 (diff) | |
download | bcm5719-llvm-a33c5a922d76248d11fb4a5567561095664986de.tar.gz bcm5719-llvm-a33c5a922d76248d11fb4a5567561095664986de.zip |
While replacing an MDNode elment, properly update MDNode's operand list.
MDNode's operand list does not include all elements.
llvm-svn: 81045
Diffstat (limited to 'llvm/lib/VMCore/LLVMContext.cpp')
-rw-r--r-- | llvm/lib/VMCore/LLVMContext.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/VMCore/LLVMContext.cpp b/llvm/lib/VMCore/LLVMContext.cpp index 887679e08d3..7d233d99216 100644 --- a/llvm/lib/VMCore/LLVMContext.cpp +++ b/llvm/lib/VMCore/LLVMContext.cpp @@ -62,9 +62,10 @@ bool LLVMContext::RemoveDeadMetadata() { return Changed; while (!DeadMDNodes.empty()) { - const MDNode *N = cast<MDNode>(DeadMDNodes.back()); DeadMDNodes.pop_back(); - if (N->use_empty()) - delete N; + Value *V = DeadMDNodes.back(); DeadMDNodes.pop_back(); + if (const MDNode *N = dyn_cast_or_null<MDNode>(V)) + if (N->use_empty()) + delete N; } } return Changed; |