Move parent assertion check before metadata deletion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82692 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp
index 5cb1040..4df536e 100644
--- a/lib/VMCore/Instruction.cpp
+++ b/lib/VMCore/Instruction.cpp
@@ -50,11 +50,11 @@
// Out of line virtual method, so the vtable, etc has a home.
Instruction::~Instruction() {
+ assert(Parent == 0 && "Instruction still linked in the program!");
if (hasMetadata()) {
LLVMContext &Context = getContext();
Context.pImpl->TheMetadata.ValueIsDeleted(this);
}
- assert(Parent == 0 && "Instruction still linked in the program!");
}