Skip to content

Commit 889ad13

Browse files
Add a codegen switch for LLVM IR verification (#3107)
This is useful for diagnosing failures "in the field".
1 parent 4f9e110 commit 889ad13

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/coreclr/jit/jitconfigvalues.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,7 @@ CONFIG_INTEGER(JitDispIns, "JitDispIns", 0)
845845
#endif // defined(TARGET_LOONGARCH64)
846846

847847
#ifdef TARGET_WASM
848+
RELEASE_CONFIG_INTEGER(JitVerifyLlvmIR, "JitVerifyLlvmIR", 0)
848849
RELEASE_CONFIG_INTEGER(JitCheckLlvmIR, "JitCheckLlvmIR", 0)
849850
RELEASE_CONFIG_INTEGER(JitRunLssaTests, "JitRunLssaTests", 0)
850851
RELEASE_CONFIG_INTEGER(JitGcStress, "JitGcStress", 0)

src/coreclr/jit/llvm.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,15 @@ static void FinishSingleThreadedCompilation(SingleThreadedCompilationContext* co
856856
module.addModuleFlag(llvm::Module::Warning, "Debug Info Version", 3);
857857
}
858858

859+
if (JitConfig.JitVerifyLlvmIR())
860+
{
861+
// Serialize verification so that the results are more legible.
862+
static CritSecObject s_verifyLock;
863+
CritSecHolder verifyLock(s_verifyLock);
864+
llvm::errs() << "Verifying: '" << module.getName() << "'\n";
865+
llvm::verifyModule(module, &llvm::errs());
866+
}
867+
859868
std::error_code code;
860869
StringRef outputFilePath = module.getName();
861870
if (JitConfig.JitCheckLlvmIR())

0 commit comments

Comments
 (0)