LLVMReactor: Always run the IR verifier.

Stuff is broken and has gone unnoticed.

Bug: b/131914569
Change-Id: I2624a38f78a05114caf69681291733343fbe1c90
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/30451
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp
index 83e0b01..b56f5f3 100644
--- a/src/Reactor/LLVMReactor.cpp
+++ b/src/Reactor/LLVMReactor.cpp
@@ -52,6 +52,7 @@
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Mangler.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/Verifier.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetOptions.h"
@@ -977,6 +978,15 @@
 			::module->print(file, 0);
 		}
 
+		// FIXME: Disable for release builds once heavy development is over.
+		bool verifyIR = true;
+		if(verifyIR)
+		{
+			llvm::legacy::PassManager pm;
+			pm.add(llvm::createVerifierPass());
+			pm.run(*::module);
+		}
+
 		if(runOptimizations)
 		{
 			optimize();