diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp index d42ca31b5aa..05600155a8c 100644 --- a/lib/IR/Verifier.cpp +++ b/lib/IR/Verifier.cpp @@ -1176,6 +1176,10 @@ void Verifier::visitBasicBlock(BasicBlock &BB) { } } } + + // Check that all instructions have their parent pointers set up correctly. + for (auto &I: BB) + Assert(I.getParent() == &BB, "Instruction has bogus parent pointer!"); } void Verifier::visitTerminatorInst(TerminatorInst &I) {