[llvm] r222488 - Verifier: Check that all instructions have their parent pointers set up

Adrian Prantl aprantl at apple.com
Thu Nov 20 16:39:43 PST 2014


Author: adrian
Date: Thu Nov 20 18:39:43 2014
New Revision: 222488

URL: http://llvm.org/viewvc/llvm-project?rev=222488&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/IR/Verifier.cpp

Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=222488&r1=222487&r2=222488&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Thu Nov 20 18:39:43 2014
@@ -1176,6 +1176,10 @@ void Verifier::visitBasicBlock(BasicBloc
       }
     }
   }
+
+  // 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) {





More information about the llvm-commits mailing list