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 | 68f195cc50a8b7722004c8f3ca3dcf624b524552 (patch) | |
tree | 83bbb57d4c4205218fb60647ab2ff46990ceb2bd /lib/VMCore/LLVMContext.cpp | |
parent | 31dcbc3b4a1dea7351af5e8c08285c91049ab2c3 (diff) |
While replacing an MDNode elment, properly update MDNode's operand list.
MDNode's operand list does not include all elements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81045 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/LLVMContext.cpp')
-rw-r--r-- | lib/VMCore/LLVMContext.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/VMCore/LLVMContext.cpp b/lib/VMCore/LLVMContext.cpp index 887679e08d..7d233d9921 100644 --- a/lib/VMCore/LLVMContext.cpp +++ b/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; |