Put LLVM IR verification behind a default-disabled flag
Verification can take upwards of 10% of a dEQP test's execution time.
Verification is enabled for Kokoro builds and unit tests as silently regressing would be a Bad Thing.
Verification is also enabled for debug (!NDEBUG) builds.
Bug: b/135609394
Change-Id: I6c354c40f524e1e8f3e08f24129b7e008163b4bd
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/33215
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 d19cf52..a65f843 100644
--- a/src/Reactor/LLVMReactor.cpp
+++ b/src/Reactor/LLVMReactor.cpp
@@ -1051,14 +1051,13 @@
::module->print(file, 0);
}
- // FIXME: Disable for release builds once heavy development is over.
- bool verifyIR = true;
- if(verifyIR)
+#if defined(ENABLE_RR_LLVM_IR_VERIFICATION) || !defined(NDEBUG)
{
llvm::legacy::PassManager pm;
pm.add(llvm::createVerifierPass());
pm.run(*::module);
}
+#endif // defined(ENABLE_RR_LLVM_IR_VERIFICATION) || !defined(NDEBUG)
if(runOptimizations)
{