Verify the whole module after codegen to catch silly IR bugs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50485 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 7e5e8f0..bf1f0d8 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -24,6 +24,7 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/Intrinsics.h"
+#include "llvm/Analysis/Verifier.h"
#include <algorithm>
using namespace clang;
using namespace CodeGen;
@@ -48,6 +49,9 @@
EmitGlobalCtors();
EmitAnnotations();
delete Runtime;
+
+ // Run the verifier to check that the generated code is consistent.
+ assert(!verifyModule(TheModule));
}
/// WarnUnsupported - Print out a warning that codegen doesn't support the