Verifier: Check that all instructions have their parent pointers set up
correctly. This helps with catching problems caused by IRBuilder abuse
such as the one fixed in CFE r222487.

llvm-svn: 222488
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index d42ca31..0560015 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -1176,6 +1176,10 @@
       }
     }
   }
+
+  // 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) {